]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: don't stop online burst when sending fails
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 20 Aug 2014 14:41:18 +0000 (16:41 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 20 Aug 2014 14:54:26 +0000 (16:54 +0200)
Don't stop online burst for unreachable sources until sending succeeds.
This is mainly useful with iburst when chronyd is started before the
network is configured.

ntp_core.c
sources.c
sources.h

index 55f1e9602289065318d426b6f77014055d28cc06..53858f69cf22538743491ba3c0e83806171011ef 100644 (file)
@@ -891,6 +891,10 @@ transmit_timeout(void *arg)
 
   switch (inst->opmode) {
     case MD_BURST_WAS_ONLINE:
+      /* When not reachable, don't stop online burst until sending succeeds */
+      if (!sent && !SRC_IsReachable(inst->source))
+        break;
+      /* Fall through */
     case MD_BURST_WAS_OFFLINE:
       --inst->burst_total_samples_to_go;
       break;
index b9e095d76241542f6a8bfa646194fab3269bcf70..e24463d1354f2626ef861249077d0e4524312e71 100644 (file)
--- a/sources.c
+++ b/sources.c
@@ -1167,6 +1167,14 @@ SRC_IsSyncPeer(SRC_Instance inst)
 
 /* ================================================== */
 
+int
+SRC_IsReachable(SRC_Instance inst)
+{
+  return inst->reachability != 0;
+}
+
+/* ================================================== */
+
 int
 SRC_ReadNumberOfSources(void)
 {
index 64c450da8b0752ebb34c4e23b7a69db0316859c3..c28102c0b9d8619c6b7c4e6929ab67c928b19fe2 100644 (file)
--- a/sources.h
+++ b/sources.h
@@ -171,6 +171,7 @@ extern void SRC_DumpSources(void);
 extern void SRC_ReloadSources(void);
 
 extern int SRC_IsSyncPeer(SRC_Instance inst);
+extern int SRC_IsReachable(SRC_Instance inst);
 extern int SRC_ReadNumberOfSources(void);
 extern int SRC_ActiveSources(void);
 extern int SRC_ReportSource(int index, RPT_SourceReport *report, struct timeval *now);