]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/resolve: optimazlization of resolution overall time checking
authorGrigorii Demidov <grigorii.demidov@nic.cz>
Mon, 11 Sep 2017 08:55:19 +0000 (10:55 +0200)
committerGrigorii Demidov <grigorii.demidov@nic.cz>
Mon, 11 Sep 2017 08:55:19 +0000 (10:55 +0200)
lib/resolve.c
lib/rplan.c
lib/rplan.h

index e4b215a8fdaea3044f2a0b9de3edb7cde009174f..30f264b9589fca8b7971625a9aa5a35fa23def2b 100644 (file)
@@ -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;
 }
 
index 9b218c0a885eb64e16ac2759bb746062898881b5..e9de8a9cd69d8993174054eb1d4d24607b449a5e 100644 (file)
@@ -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)
index 6271869adda7f7401d3eb8a0b5a7acb570c99cad..9a0998474aa6b55e5207cbcf9bc7a147fc91adbf 100644 (file)
@@ -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;