From: Vladimír Čunát Date: Wed, 15 Mar 2017 15:37:36 +0000 (+0100) Subject: worker_resolve: truly honor the options parameter X-Git-Tag: v1.3.0~23^2~55^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d37ec7e25004f19777562d102b4cd7ec77ddf39d;p=thirdparty%2Fknot-resolver.git worker_resolve: truly honor the options parameter It was being overwritten by options from struct kr_context; now the flags are combined (by set union). For example, the NO_CACHE flag is important for the prefetch module and for trust anchor updates. --- diff --git a/daemon/worker.c b/daemon/worker.c index 21efd306b..b31c7a18c 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -1049,9 +1049,12 @@ int worker_resolve(struct worker_ctx *worker, knot_pkt_t *query, unsigned option } task->baton = baton; task->on_complete = on_complete; - task->req.options |= options; /* Start task */ int ret = qr_task_start(task, query); + + /* Set options late, as qr_task_start() -> kr_resolve_begin() rewrite it. */ + task->req.options |= options; + if (ret != 0) { qr_task_unref(task); return ret; diff --git a/daemon/worker.h b/daemon/worker.h index 4219f4a1e..c99a429d4 100644 --- a/daemon/worker.h +++ b/daemon/worker.h @@ -54,7 +54,11 @@ int worker_end_tcp(struct worker_ctx *worker, uv_handle_t *handle); /** * Schedule query for resolution. + * * @return 0 or an error code + * + * @note the options passed are |-combined with struct kr_context::options + * @todo maybe better semantics for this? */ int worker_resolve(struct worker_ctx *worker, knot_pkt_t *query, unsigned options, worker_cb_t on_complete, void *baton);