Commit 742238d4 authored by Marek Vavrusa's avatar Marek Vavrusa

lib/resolve: added synchronous cache option

parent bd6d82ae
......@@ -57,9 +57,9 @@ static int produce_yield(knot_layer_t *ctx, knot_pkt_t *pkt) { return kr_ok(); }
/** Enforce cache flushing in debug mode. */
static void flush_caches(struct kr_request *req) {
#ifdef DEBUG
kr_cache_sync(&req->ctx->cache);
#endif
if (req->options & QUERY_CACHE_SYNC) {
kr_cache_sync(&req->ctx->cache);
}
}
/** @internal Macro for iterating module layers. */
#define RESUME_LAYERS(from, req, qry, func, ...) \
......@@ -69,7 +69,6 @@ static void flush_caches(struct kr_request *req) {
if (mod->layer) { \
struct knot_layer layer = {.state = (req)->state, .api = mod->layer(mod), .data = (req)}; \
if (layer.api && layer.api->func) { \
flush_caches(req); \
(req)->state = layer.api->func(&layer, ##__VA_ARGS__); \
if ((req)->state == KNOT_STATE_YIELD) { \
func ## _yield(&layer, ##__VA_ARGS__); \
......@@ -77,7 +76,8 @@ static void flush_caches(struct kr_request *req) {
} \
} \
} \
} /* Invalidate current query. */ \
} /* Invalidate current query and maybe flush caches. */ \
flush_caches(req); \
(req)->current_query = NULL
/** @internal Macro for starting module iteration. */
......
......@@ -47,6 +47,7 @@
X(DNSSEC_WEXPAND, 1 << 19) /**< Query response has wildcard expansion. */ \
X(PERMISSIVE, 1 << 20) /**< Permissive resolver mode. */ \
X(STRICT, 1 << 21) /**< Strict resolver mode. */ \
X(CACHE_SYNC, 1 << 22) /**< Sync cache as often as possible. */
/** Query flags */
enum kr_query_flag {
......
Subproject commit 85cbf82244059113ff3149da04f99089dddc1c5b
Subproject commit 1bdecfcde89a39d47dfcc03a0712a04bb668583f
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