From 5ec2f051f4526e7025633d941f0eeec15c2ceb40 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Ondr=C3=A1=C4=8Dek?= Date: Tue, 23 Jul 2024 13:33:29 +0200 Subject: [PATCH] defer: fix DoH --- daemon/defer.c | 7 ++++++- daemon/session2.c | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) 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; } -- 2.47.2