From: Lukáš Ondráček Date: Tue, 23 Jul 2024 11:33:29 +0000 (+0200) Subject: defer: fix DoH X-Git-Tag: v6.0.9~1^2~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fenvironments%2Fdocs-develop-rrl-8r8r8r%2Fdeployments%2F4644;p=thirdparty%2Fknot-resolver.git defer: fix DoH --- diff --git a/daemon/defer.c b/daemon/defer.c index 884ae8727..89d792652 100644 --- a/daemon/defer.c +++ b/daemon/defer.c @@ -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; } diff --git a/daemon/session2.c b/daemon/session2.c index 22a0902d5..b7511cd7c 100644 --- a/daemon/session2.c +++ b/daemon/session2.c @@ -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; }