From: Marek VavruĊĦa Date: Fri, 23 Mar 2018 16:40:36 +0000 (-0700) Subject: cache: restore flagging entries written into cache X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Frestore-rrarray-entry-cached;p=thirdparty%2Fknot-resolver.git cache: restore flagging entries written into cache This was probably lost during the cache backend rewrite in 2.x fixes #332 --- diff --git a/lib/cache/api.c b/lib/cache/api.c index 01cec8e8f..577272b4c 100644 --- a/lib/cache/api.c +++ b/lib/cache/api.c @@ -652,6 +652,8 @@ int cache_stash(kr_layer_t *ctx, knot_pkt_t *pkt) VERBOSE_MSG(qry, "=> stashing RRs errored out\n"); goto finally; } + /* Mark entry as cached for the rest of the query processing */ + entry->cached = true; /* LATER(optim.): maybe filter out some type-rank combinations * that won't be useful as separate RRsets. */ } @@ -712,7 +714,7 @@ static int stash_rrset(const ranked_rr_array_t *arr, int arr_i, /* TODO: ATM we assume that some properties are the same * for all RRSIGs in the set (esp. label count). */ ranked_rr_array_entry_t *e = arr->at[j]; - bool ok = e->qry_uid == qry->uid && !e->cached + bool ok = e->qry_uid == qry->uid && e->rr->type == KNOT_RRTYPE_RRSIG && knot_rrsig_type_covered(&e->rr->rrs, 0) == rr->type && knot_dname_is_equal(rr->owner, e->rr->owner); diff --git a/lib/utils.h b/lib/utils.h index bd646751c..4f4cac33a 100644 --- a/lib/utils.h +++ b/lib/utils.h @@ -145,7 +145,7 @@ struct ranked_rr_array_entry { uint32_t qry_uid; uint8_t rank; /**< enum kr_rank */ uint8_t revalidation_cnt; - bool cached : 1; /**< whether it has been stashed to cache already */ + bool cached : 1; /**< Set to true if the entry was written into cache */ bool yielded : 1; bool to_wire : 1; /**< whether to be put into the answer */ bool expiring : 1; /**< low remaining TTL; see is_expiring; only used in cache ATM */