From: Lukáš Ondráček Date: Mon, 2 Jun 2025 14:56:42 +0000 (+0200) Subject: daemon/defer: fix sampling of timed events X-Git-Tag: v6.0.15~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9eb8e6bc403b8e7de8046f14ff4f79380fd07d73;p=thirdparty%2Fknot-resolver.git daemon/defer: fix sampling of timed events --- diff --git a/daemon/session2.c b/daemon/session2.c index 997e54544..fc3a65430 100644 --- a/daemon/session2.c +++ b/daemon/session2.c @@ -1336,7 +1336,7 @@ void session2_event(struct session2 *s, enum protolayer_event_type event, void * * From inside: close by us, statistics, ... * From outside: timeout, EOF, close by external reasons, ... */ bool defer_accounting_here = false; - if (!defer_sample_is_accounting() && s->stream && !s->outgoing) { + if (!defer_sample_is_accounting()) { defer_sample_start(NULL); defer_accounting_here = true; } diff --git a/daemon/worker.c b/daemon/worker.c index f7d253234..c912fd158 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -1912,8 +1912,10 @@ static enum protolayer_event_cb_result pl_dns_stream_resolution_timeout( worker_task_finalize(t, KR_STATE_FAIL); worker_task_unref(t); the_worker->stats.timeout += 1; - if (s->closing) + if (s->closing) { + defer_sample_stop(&defer_prev_sample_state, true); return PROTOLAYER_EVENT_PROPAGATE; + } defer_sample_restart(); } while (!session2_waitinglist_is_empty(s)); defer_sample_stop(&defer_prev_sample_state, true);