Klaus Demo nginx / b69a35f
Resolver: fixed handling of partially resolved SRV. The resolver handles SRV requests in two stages. In the first stage it gets all SRV RRs, and in the second stage it resolves the names from SRV RRs into addresses. Previously, if a response to an SRV request was cached, the queries to resolve names were not limited by a timeout. If a response to any of these queries was not received, the SRV request could never complete. If a response to an SRV request was not cached, and some of the queries to resolve names timed out, NGX_RESOLVE_TIMEDOUT was returned instead of successfully resolved addresses. To fix both issues, resolving of names is now always limited by a timeout. Dmitry Volyntsev 3 years ago
1 changed file(s) with 5 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
29542954 ctx->srvs = srvs;
29552955 ctx->nsrvs = rn->nsrvs;
29562956
2957 if (ctx->event && ctx->event->timer_set) {
2958 ngx_del_timer(ctx->event);
2959 }
2960
29572961 for (i = 0; i < rn->nsrvs; i++) {
29582962 srvs[i].name.data = ngx_resolver_alloc(r, rn->u.srvs[i].name.len);
29592963 if (srvs[i].name.data == NULL) {
29732977 cctx->handler = ngx_resolver_srv_names_handler;
29742978 cctx->data = ctx;
29752979 cctx->srvs = &srvs[i];
2976 cctx->timeout = 0;
2980 cctx->timeout = ctx->timeout;
29772981
29782982 srvs[i].priority = rn->u.srvs[i].priority;
29792983 srvs[i].weight = rn->u.srvs[i].weight;