Klaus Demo nginx / dfd5511
use cf->cycle->new_log because at merge stage cf->pool->log is old log Igor Sysoev 14 years ago
4 changed file(s) with 12 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
9191 /* STUB: ngx_peer_addr_t * */
9292
9393 ngx_resolver_t *
94 ngx_resolver_create(ngx_pool_t *pool, ngx_peer_addr_t *addr)
94 ngx_resolver_create(ngx_conf_t *cf, ngx_peer_addr_t *addr)
9595 {
9696 ngx_resolver_t *r;
9797 ngx_pool_cleanup_t *cln;
9898 ngx_udp_connection_t *uc;
9999
100 cln = ngx_pool_cleanup_add(pool, 0);
100 cln = ngx_pool_cleanup_add(cf->pool, 0);
101101 if (cln == NULL) {
102102 return NULL;
103103 }
104104
105105 cln->handler = ngx_resolver_cleanup;
106106
107 r = ngx_calloc(sizeof(ngx_resolver_t), pool->log);
107 r = ngx_calloc(sizeof(ngx_resolver_t), cf->log);
108108 if (r == NULL) {
109109 return NULL;
110110 }
111111
112112 cln->data = r;
113113
114 r->event = ngx_calloc(sizeof(ngx_event_t), pool->log);
114 r->event = ngx_calloc(sizeof(ngx_event_t), cf->log);
115115 if (r->event == NULL) {
116116 return NULL;
117117 }
130130
131131 r->event->handler = ngx_resolver_resend_handler;
132132 r->event->data = r;
133 r->event->log = pool->log;
133 r->event->log = cf->cycle->new_log;
134134 r->ident = -1;
135135
136136 r->resend_timeout = 5;
137137 r->expire = 30;
138138 r->valid = 300;
139139
140 r->log = pool->log;
140 r->log = cf->cycle->new_log;
141141 r->log_level = NGX_LOG_ALERT;
142142
143143 if (addr) {
144 uc = ngx_calloc(sizeof(ngx_udp_connection_t), pool->log);
144 uc = ngx_calloc(sizeof(ngx_udp_connection_t), cf->log);
145145 if (uc == NULL) {
146146 return NULL;
147147 }
151151 uc->sockaddr = addr->sockaddr;
152152 uc->socklen = addr->socklen;
153153 uc->server = addr->name;
154 uc->log = pool->log;
154 uc->log = cf->log;
155155 }
156156
157157 return r;
130130 };
131131
132132
133 ngx_resolver_t *ngx_resolver_create(ngx_pool_t *pool, ngx_peer_addr_t *addr);
133 ngx_resolver_t *ngx_resolver_create(ngx_conf_t *cf, ngx_peer_addr_t *addr);
134134 ngx_resolver_ctx_t *ngx_resolve_start(ngx_resolver_t *r,
135135 ngx_resolver_ctx_t *temp);
136136 ngx_int_t ngx_resolve_name(ngx_resolver_ctx_t *ctx);
29092909 conf->resolver = prev->resolver;
29102910
29112911 if (conf->resolver == NULL) {
2912 conf->resolver = ngx_resolver_create(cf->pool, NULL);
2912 conf->resolver = ngx_resolver_create(cf, NULL);
29132913 if (conf->resolver == NULL) {
29142914 return NGX_CONF_ERROR;
29152915 }
37273727 return NGX_CONF_ERROR;
37283728 }
37293729
3730 clcf->resolver = ngx_resolver_create(cf->pool, &u.addrs[0]);
3730 clcf->resolver = ngx_resolver_create(cf, &u.addrs[0]);
37313731 if (clcf->resolver == NULL) {
37323732 return NGX_OK;
37333733 }
436436 return NGX_CONF_ERROR;
437437 }
438438
439 cscf->resolver = ngx_resolver_create(cf->pool, &u.addrs[0]);
439 cscf->resolver = ngx_resolver_create(cf, &u.addrs[0]);
440440 if (cscf->resolver == NULL) {
441441 return NGX_CONF_OK;
442442 }