From: Michael Tremer Date: Sun, 12 Jul 2026 11:13:37 +0000 (+0000) Subject: source: Reset the results counter on disable X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=408a11419562ef68208f9c5f9573ef83fb6fd747;p=telemetry.git source: Reset the results counter on disable That way, we don't carry over any errors if the source get re-enabled. Signed-off-by: Michael Tremer --- diff --git a/src/daemon/source.c b/src/daemon/source.c index b1e3989..ffa8f04 100644 --- a/src/daemon/source.c +++ b/src/daemon/source.c @@ -122,6 +122,10 @@ struct td_source { } results; }; +static void td_source_reset_results(td_source* self) { + self->results.num = 0; +} + static int td_source_change_state(td_source* self, enum td_source_state state) { // If the state has not changed, we are doing nothing if (self->state == state) @@ -146,6 +150,10 @@ static int td_source_change_state(td_source* self, enum td_source_state state) { case STATE_DISABLED: DEBUG(self->ctx, "%s has been disabled\n", td_source_name(self)); + + // Reset the results + td_source_reset_results(self); + break; }