Resolver: introduced valid field in resolver responses.
It hints the amount of time a response could be considered
as valid.
diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c
index 7f0d3ad..40eefc5 100644
--- a/src/core/ngx_resolver.c
+++ b/src/core/ngx_resolver.c
@@ -551,6 +551,7 @@
do {
ctx->state = NGX_OK;
+ ctx->valid = rn->valid;
ctx->naddrs = naddrs;
if (addrs == NULL) {
@@ -597,6 +598,7 @@
do {
ctx->state = NGX_RESOLVE_NXDOMAIN;
+ ctx->valid = ngx_time() + (r->valid ? r->valid : 10);
next = ctx->next;
ctx->handler(ctx);
@@ -859,6 +861,7 @@
/* unlock addr mutex */
ctx->state = NGX_OK;
+ ctx->valid = rn->valid;
ctx->handler(ctx);
@@ -1948,6 +1951,7 @@
while (next) {
ctx = next;
ctx->state = code;
+ ctx->valid = ngx_time() + (r->valid ? r->valid : 10);
next = ctx->next;
ctx->handler(ctx);
@@ -2262,6 +2266,7 @@
while (next) {
ctx = next;
ctx->state = NGX_OK;
+ ctx->valid = rn->valid;
ctx->naddrs = naddrs;
if (addrs == NULL) {
@@ -2541,6 +2546,7 @@
while (next) {
ctx = next;
ctx->state = code;
+ ctx->valid = ngx_time() + (r->valid ? r->valid : 10);
next = ctx->next;
ctx->handler(ctx);
@@ -2675,6 +2681,7 @@
while (next) {
ctx = next;
ctx->state = NGX_OK;
+ ctx->valid = rn->valid;
ctx->name = name;
next = ctx->next;