Commit efd29680 authored by Grigorii Demidov's avatar Grigorii Demidov

lib/resolve: optimazlization of resolution overall time checking

parent c3614bd4
......@@ -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;
}
......
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment