From: Frantisek Tobias Date: Mon, 6 Oct 2025 13:11:45 +0000 (+0200) Subject: daemon/session: start defer only for DOQ_CONN X-Git-Tag: v6.2.0~2^2~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18825c101522f05ab9dd0b70c72d2d0b04a0251a;p=thirdparty%2Fknot-resolver.git daemon/session: start defer only for DOQ_CONN --- diff --git a/daemon/defer.h b/daemon/defer.h index 8eae1033f..e6ade87aa 100644 --- a/daemon/defer.h +++ b/daemon/defer.h @@ -91,7 +91,7 @@ static inline void defer_sample_addr(const union kr_sockaddr *addr, bool stream) static inline void defer_sample_start_stamp(uint64_t stamp) { if (!defer) return; - if (defer_sample_state.is_accounting) return; + kr_assert(!defer_sample_state.is_accounting); defer_sample_state.is_accounting = true; defer_sample_state.stamp = stamp; defer_sample_state.addr.ip.sa_family = AF_UNSPEC; @@ -101,7 +101,7 @@ static inline void defer_sample_start_stamp(uint64_t stamp) static inline void defer_sample_stop_stamp(uint64_t stamp) { if (!defer) return; - // kr_assert(defer_sample_state.is_accounting); + kr_assert(defer_sample_state.is_accounting); defer_sample_state.is_accounting = false; if (defer_sample_state.addr.ip.sa_family == AF_UNSPEC) return; diff --git a/daemon/session2.c b/daemon/session2.c index 1af90d77b..17fe8e2f0 100644 --- a/daemon/session2.c +++ b/daemon/session2.c @@ -641,7 +641,9 @@ 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) && (layer_ix == 0)) + if ((direction == PROTOLAYER_UNWRAP) && (layer_ix == 0) && + session->proto != KR_PROTO_DOQ_STREAM && + session->proto != KR_PROTO_DOQ) defer_sample_start(NULL); struct protolayer_iter_ctx *ctx = malloc(session->iter_ctx_size); @@ -704,7 +706,9 @@ static int session2_submit( } int ret = protolayer_step(ctx); - if ((direction == PROTOLAYER_UNWRAP) && (layer_ix == 0)) + if ((direction == PROTOLAYER_UNWRAP) && (layer_ix == 0) && + session->proto != KR_PROTO_DOQ_STREAM && + session->proto != KR_PROTO_DOQ) defer_sample_stop(NULL, false); return ret; }