]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sources: add more assertions
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 4 Jun 2020 07:49:17 +0000 (09:49 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 4 Jun 2020 12:50:17 +0000 (14:50 +0200)
sources.c

index f134c785b74b4c460997a1aa52f7836b958c2922..9fc5a0edaf764b786fe4486163a4614bcdca6c0a 100644 (file)
--- a/sources.c
+++ b/sources.c
@@ -1025,8 +1025,13 @@ SRC_SelectSource(SRC_Instance updated_inst)
       default:
         assert(0);
     }
+    assert(trust_depth <= depth);
+    assert(trust_depth >= 0);
   }
 
+  assert(depth == 0 && trust_depth == 0);
+  assert(2 * n_sel_sources == n_endpoints);
+
   if ((best_trust_depth == 0 && best_depth <= n_sel_sources / 2) ||
       (best_trust_depth > 0 && best_trust_depth <= n_sel_trust_sources / 2)) {
     /* Could not even get half the reachable (trusted) sources to agree */