mirror of
https://github.com/nginx/nginx.git
synced 2024-12-19 21:53:31 -06:00
Resolver: do not enable resolve timer if provided timeout is zero.
This commit is contained in:
parent
98f222c6c1
commit
2b2fe92aaa
@ -611,7 +611,7 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx,
|
||||
|
||||
if (rn->waiting) {
|
||||
|
||||
if (ctx->event == NULL) {
|
||||
if (ctx->event == NULL && ctx->timeout) {
|
||||
ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t));
|
||||
if (ctx->event == NULL) {
|
||||
return NGX_ERROR;
|
||||
@ -729,7 +729,7 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx,
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (ctx->event == NULL) {
|
||||
if (ctx->event == NULL && ctx->timeout) {
|
||||
ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t));
|
||||
if (ctx->event == NULL) {
|
||||
goto failed;
|
||||
@ -872,18 +872,20 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx)
|
||||
|
||||
if (rn->waiting) {
|
||||
|
||||
ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t));
|
||||
if (ctx->event == NULL) {
|
||||
return NGX_ERROR;
|
||||
if (ctx->event == NULL && ctx->timeout) {
|
||||
ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t));
|
||||
if (ctx->event == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ctx->event->handler = ngx_resolver_timeout_handler;
|
||||
ctx->event->data = ctx;
|
||||
ctx->event->log = r->log;
|
||||
ctx->ident = -1;
|
||||
|
||||
ngx_add_timer(ctx->event, ctx->timeout);
|
||||
}
|
||||
|
||||
ctx->event->handler = ngx_resolver_timeout_handler;
|
||||
ctx->event->data = ctx;
|
||||
ctx->event->log = r->log;
|
||||
ctx->ident = -1;
|
||||
|
||||
ngx_add_timer(ctx->event, ctx->timeout);
|
||||
|
||||
ctx->next = rn->waiting;
|
||||
rn->waiting = ctx;
|
||||
ctx->state = NGX_AGAIN;
|
||||
@ -949,18 +951,20 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx)
|
||||
goto failed;
|
||||
}
|
||||
|
||||
ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t));
|
||||
if (ctx->event == NULL) {
|
||||
goto failed;
|
||||
if (ctx->event == NULL && ctx->timeout) {
|
||||
ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t));
|
||||
if (ctx->event == NULL) {
|
||||
goto failed;
|
||||
}
|
||||
|
||||
ctx->event->handler = ngx_resolver_timeout_handler;
|
||||
ctx->event->data = ctx;
|
||||
ctx->event->log = r->log;
|
||||
ctx->ident = -1;
|
||||
|
||||
ngx_add_timer(ctx->event, ctx->timeout);
|
||||
}
|
||||
|
||||
ctx->event->handler = ngx_resolver_timeout_handler;
|
||||
ctx->event->data = ctx;
|
||||
ctx->event->log = r->log;
|
||||
ctx->ident = -1;
|
||||
|
||||
ngx_add_timer(ctx->event, ctx->timeout);
|
||||
|
||||
if (ngx_queue_empty(resend_queue)) {
|
||||
ngx_add_timer(r->event, (ngx_msec_t) (r->resend_timeout * 1000));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user