From: Grigorii Demidov Date: Mon, 11 Sep 2017 08:55:19 +0000 (+0200) Subject: lib/resolve: optimazlization of resolution overall time checking X-Git-Tag: v1.4.0~7^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efd296808714d355cd1639dea1558d2d48e0fa2a;p=thirdparty%2Fknot-resolver.git lib/resolve: optimazlization of resolution overall time checking --- diff --git a/lib/resolve.c b/lib/resolve.c index e4b215a8f..30f264b95 100644 --- a/lib/resolve.c +++ b/lib/resolve.c @@ -869,25 +869,6 @@ bool check_resolution_time(struct kr_query *qry, struct timeval *now) } return false; } - - /* If this is a subquery, check overall resolution time for parent */ - if (!qry->parent) { - return true; - } - - while (qry->parent) { - qry = qry->parent; - } - - /* qry here is an oldest ancestor */ - resolving_time = time_diff(&qry->creation_time, now); - if (resolving_time > KR_RESOLVE_TIME_LIMIT) { - /* oldest ancestor is too old */ - WITH_VERBOSE { - VERBOSE_MSG(qry, "query resolution time limit exceeded\n"); - } - return false; - } return true; } diff --git a/lib/rplan.c b/lib/rplan.c index 9b218c0a8..e9de8a9cd 100644 --- a/lib/rplan.c +++ b/lib/rplan.c @@ -154,7 +154,7 @@ static struct kr_query *kr_rplan_push_query(struct kr_rplan *rplan, qry->ns.ctx = rplan->request->ctx; qry->ns.addr[0].ip.sa_family = AF_UNSPEC; gettimeofday(&qry->timestamp, NULL); - qry->creation_time = qry->timestamp; + qry->creation_time = parent ? parent->creation_time : qry->timestamp; kr_zonecut_init(&qry->zone_cut, (const uint8_t *)"", rplan->pool); qry->reorder = qry->flags.REORDER_RR ? knot_wire_get_id(rplan->request->answer->wire) diff --git a/lib/rplan.h b/lib/rplan.h index 6271869ad..9a0998474 100644 --- a/lib/rplan.h +++ b/lib/rplan.h @@ -83,7 +83,9 @@ struct kr_query { uint32_t secret; uint16_t fails; uint16_t reorder; /**< Seed to reorder (cached) RRs in answer or zero. */ - struct timeval creation_time; + struct timeval creation_time; /* The time of query's creation. + * Or time of creation of an oldest + * ancestor if it is a subquery. */ struct timeval timestamp; struct kr_zonecut zone_cut; struct kr_nsrep ns;