]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
defer: fix DoH docs-develop-rrl-8r8r8r/deployments/4644
authorLukáš Ondráček <lukas.ondracek@nic.cz>
Tue, 23 Jul 2024 11:33:29 +0000 (13:33 +0200)
committerLukáš Ondráček <lukas.ondracek@nic.cz>
Tue, 23 Jul 2024 15:14:34 +0000 (17:14 +0200)
daemon/defer.c
daemon/session2.c

index 884ae8727d15f2db75095f633bc98e926a71cdb1..89d792652bf49d926b61d812b8372c6943788323 100644 (file)
@@ -181,8 +181,13 @@ static inline void process_single_deferred(void) {
                        queue_ix,
                        age_ns / 1000000.0);
 
+       if (ctx->session->closing) {
+               VERBOSE_LOG("    BREAK (session is closing)\n");
+               protolayer_break(ctx, kr_error(ECANCELED));
+               return;
+       }
        if (age_ns >= REQ_TIMEOUT) {
-               VERBOSE_LOG("    BREAK\n");
+               VERBOSE_LOG("    BREAK (timeout)\n");
                protolayer_break(ctx, kr_error(ETIME));
                return;
        }
index 22a0902d547a1200c0bfca74cd55bd8484aa3173..b7511cd7c9ee5318ec4266ee1a8a3f20a6d27d19 100644 (file)
@@ -602,7 +602,7 @@ static int session2_submit(
        // but we may not know the client's IP yet.
        // Note two cases: incoming session (new request)
        // vs. outgoing session (resuming work on some request)
-       if (direction == PROTOLAYER_UNWRAP)
+       if ((direction == PROTOLAYER_UNWRAP) && (layer_ix == 0))
                defer_sample_start();
 
        int ret;
@@ -663,7 +663,7 @@ static int session2_submit(
        }
 
        ret = protolayer_step(ctx);
-       if (direction == PROTOLAYER_UNWRAP)
+       if ((direction == PROTOLAYER_UNWRAP) && (layer_ix == 0))
                defer_sample_stop();
        return ret;
 }