From: Miroslav Lichvar Date: Wed, 20 Aug 2014 14:41:18 +0000 (+0200) Subject: ntp: don't stop online burst when sending fails X-Git-Tag: 1.31-pre1~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e66b5ce8a7c060c77480995919e5d1ba28394df;p=thirdparty%2Fchrony.git ntp: don't stop online burst when sending fails 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. --- diff --git a/ntp_core.c b/ntp_core.c index 55f1e960..53858f69 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -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; diff --git a/sources.c b/sources.c index b9e095d7..e24463d1 100644 --- 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) { diff --git a/sources.h b/sources.h index 64c450da..c28102c0 100644 --- 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);