Mercurial > hg > nginx
comparison src/mysql/ngx_http_mysql_test.c @ 884:4d68c486fcb0
upstream choice modules
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 04 Dec 2006 16:46:13 +0000 |
parents | 63a820b0bc6c |
children | a0310ac2814f |
comparison
equal
deleted
inserted
replaced
883:eac23634d614 | 884:4d68c486fcb0 |
---|---|
8 #include <ngx_mysql.h> | 8 #include <ngx_mysql.h> |
9 #include <ngx_http.h> | 9 #include <ngx_http.h> |
10 | 10 |
11 | 11 |
12 typedef struct { | 12 typedef struct { |
13 ngx_peers_t *peers; | 13 ngx_peer_addr_t *peers; |
14 ngx_uint_t npeers; | |
14 } ngx_http_mysql_test_conf_t; | 15 } ngx_http_mysql_test_conf_t; |
15 | 16 |
16 | 17 |
17 static void ngx_http_mysql_auth(ngx_mysql_t *m); | 18 static void ngx_http_mysql_auth(ngx_mysql_t *m); |
18 static void ngx_http_mysql_done(ngx_mysql_t *m); | 19 static void ngx_http_mysql_done(ngx_mysql_t *m); |
92 | 93 |
93 m->login = &ngx_mysql_login; | 94 m->login = &ngx_mysql_login; |
94 m->passwd = &ngx_mysql_passwd; | 95 m->passwd = &ngx_mysql_passwd; |
95 m->database = &ngx_mysql_database; | 96 m->database = &ngx_mysql_database; |
96 | 97 |
98 /* STUB */ | |
99 m->peer.sockaddr = mtcf->peers[0].sockaddr; | |
100 m->peer.socklen = mtcf->peers[0].socklen; | |
101 m->peer.name = &mtcf->peers[0].name; | |
102 m->peer.tries = mtcf->npeers; | |
103 m->peer.get = ngx_event_get_peer; | |
104 /**/ | |
97 m->peer.log = r->connection->log; | 105 m->peer.log = r->connection->log; |
98 m->peer.log_error = NGX_ERROR_ERR; | 106 m->peer.log_error = NGX_ERROR_ERR; |
99 m->peer.peers = mtcf->peers; | |
100 m->peer.tries = mtcf->peers->number; | |
101 | 107 |
102 rc = ngx_mysql_connect(m); | 108 rc = ngx_mysql_connect(m); |
103 | 109 |
104 if (rc == NGX_OK || rc == NGX_AGAIN) { | 110 if (rc == NGX_OK || rc == NGX_AGAIN) { |
105 return NGX_DONE; | 111 return NGX_DONE; |
188 } | 194 } |
189 | 195 |
190 return NGX_CONF_ERROR; | 196 return NGX_CONF_ERROR; |
191 } | 197 } |
192 | 198 |
193 mtcf->peers = u.peers; | 199 mtcf->peers = u.addrs; |
200 mtcf->npeers = u.naddrs; | |
194 | 201 |
195 return NGX_CONF_OK; | 202 return NGX_CONF_OK; |
196 } | 203 } |