From: Miroslav Lichvar Date: Mon, 6 Dec 2010 13:53:37 +0000 (+0100) Subject: Slowly back off sampling rate when selected source loses connectivity X-Git-Tag: 1.25-pre1~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8b93e1a7809ffd505449dd7819fa6355ef7fa1ee;p=thirdparty%2Fchrony.git Slowly back off sampling rate when selected source loses connectivity --- diff --git a/ntp_core.c b/ntp_core.c index 24bcc2ec..a62557d7 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -645,20 +645,13 @@ transmit_timeout(void *arg) /* Nothing */ } - /* If the source to which we are currently locked starts to lose - connectivity, increase the sampling rate to try and bring it - back. If any other source loses connectivity, back off the - sampling rate to reduce wasted sampling. */ - - if (SRC_IsSyncPeer(inst->source)) { - if (inst->tx_count >= 2) { - /* Implies we have missed at least one transmission */ - adjust_poll(inst, -0.75); - } - } else { - if (inst->tx_count >= 2) { - adjust_poll(inst, 0.25); - } + /* If the source loses connectivity, back off the sampling rate to reduce + wasted sampling. If it's the source to which we are currently locked, + back off slower. */ + + if (inst->tx_count >= 2) { + /* Implies we have missed at least one transmission */ + adjust_poll(inst, SRC_IsSyncPeer(inst->source) ? 0.1 : 0.25); } my_mode = inst->mode;