]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sources: reselect after resetting selected source
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 21 Nov 2023 10:05:41 +0000 (11:05 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 21 Nov 2023 11:38:41 +0000 (12:38 +0100)
Avoid showing in the sources report a selected source which has no
samples (e.g. after replacement).

sources.c

index e8e970536e53a77c16b59b2c52147106e4311a4e..ec09ff3112e0651e00fbb9e81692939ad9d97117 100644 (file)
--- a/sources.c
+++ b/sources.c
@@ -357,6 +357,9 @@ SRC_ResetInstance(SRC_Instance instance)
   memset(&instance->sel_info, 0, sizeof (instance->sel_info));
 
   SST_ResetInstance(instance->stats);
+
+  if (selected_source_index == instance->index)
+    SRC_SelectSource(NULL);
 }
 
 /* ================================================== */