]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/defer: fix sampling of timed events
authorLukáš Ondráček <lukas.ondracek@nic.cz>
Mon, 2 Jun 2025 14:56:42 +0000 (16:56 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 16 Jul 2025 08:30:14 +0000 (10:30 +0200)
daemon/session2.c
daemon/worker.c

index 997e54544d5419b3479321332cf68b6a93397825..fc3a65430fafeff2aec33b2bd552245508071b36 100644 (file)
@@ -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;
        }
index f7d2532342805ba28e4b7515c3b59326d6d5b3c5..c912fd158906171bdea8174d9b6c55d6fc60514d 100644 (file)
@@ -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);