]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
wiwipp
authorŠtěpán Balážik <stepan.balazik@nic.cz>
Fri, 28 May 2021 20:06:18 +0000 (22:06 +0200)
committerŠtěpán Balážik <stepan.balazik@nic.cz>
Fri, 28 May 2021 20:06:18 +0000 (22:06 +0200)
daemon/main.c
daemon/worker.c
daemon/worker.h

index 8bbd5609b844733da86a9a82239eb4c419971131..66365e274057b43ee0598ad0ec0f4e07201190ad 100644 (file)
@@ -579,6 +579,12 @@ int main(int argc, char **argv)
        ret = run_worker(loop, &engine, fork_id == 0, the_args);
 
 cleanup:/* Cleanup. */
+       for (int j=0; j<1<<20; j++) {
+               if (the_worker->tasks[j] && the_worker->tasks[j]->refs) {
+                       printf("%p\n", the_worker->tasks[j]);
+               }
+       }
+       printf("bye!");
        engine_deinit(&engine);
        worker_deinit();
        if (loop != NULL) {
index b13bb3911f1ee1eff4e3588ac607bc50f2021bb6..c71192e0a5bc863a3e35becd3d0d0b870d587d1d 100644 (file)
@@ -37,7 +37,6 @@
 #include "lib/layer.h"
 #include "lib/utils.h"
 
-
 /* Magic defaults for the worker. */
 #ifndef MP_FREELIST_SIZE
 # ifdef __clang_analyzer__
@@ -75,26 +74,6 @@ struct request_ctx
        } source;
 };
 
-/** Query resolution task. */
-struct qr_task
-{
-       struct request_ctx *ctx;
-       knot_pkt_t *pktbuf;
-       qr_tasklist_t waiting;
-       struct session *pending[MAX_PENDING];
-       uint16_t pending_count;
-       uint16_t timeouts;
-       uint16_t iter_count;
-       uint32_t refs;
-       bool finished : 1;
-       bool leading  : 1;
-       uint64_t creation_time;
-       uint64_t send_time;
-       uint64_t recv_time;
-       struct kr_transport *transport;
-};
-
-
 /* Convenience macros */
 #define qr_task_ref(task) \
        do { ++(task)->refs; } while(0)
@@ -506,6 +485,9 @@ static struct qr_task *qr_task_create(struct request_ctx *ctx)
        qr_task_ref(task);
        task->creation_time = kr_now();
        ctx->worker->stats.concurrent += 1;
+       the_worker->tasks[the_worker->task_index] = task;
+       the_worker->task_index++;
+       the_worker->task_index %= 1<<20;
        return task;
 }
 
index 5f7be5b43ba301342bc5bfae2ff72d06a961be85..8df997d3610b47f33acc20d6ef76561326f986db 100644 (file)
@@ -158,6 +158,26 @@ typedef array_t(struct mempool *) mp_freelist_t;
 /** List of query resolution tasks. */
 typedef array_t(struct qr_task *) qr_tasklist_t;
 
+/** Query resolution task. */
+struct qr_task
+{
+       struct request_ctx *ctx;
+       knot_pkt_t *pktbuf;
+       qr_tasklist_t waiting;
+       struct session *pending[MAX_PENDING];
+       uint16_t pending_count;
+       uint16_t timeouts;
+       uint16_t iter_count;
+       uint32_t refs;
+       bool finished : 1;
+       bool leading  : 1;
+       uint64_t creation_time;
+       uint64_t send_time;
+       uint64_t recv_time;
+       struct kr_transport *transport;
+};
+
+
 /** \details Worker state is meant to persist during the whole life of daemon. */
 struct worker_ctx {
        struct engine *engine;
@@ -186,6 +206,9 @@ struct worker_ctx {
        mp_freelist_t pool_mp;
        knot_mm_t pkt_pool;
        unsigned int next_request_uid;
+
+       struct qr_task *tasks[1<<20];
+       int task_index;
 };
 
 /** @endcond */