File 0001-Exit-when-excessive-drift-workaround.patch of Package basicstation

From 6efb7444873958555199b547c06e79fdcd3e0cd8 Mon Sep 17 00:00:00 2001
From: Frank Kunz <mailinglists@kunz-im-inter.net>
Date: Wed, 17 Mar 2021 16:53:14 +0100
Subject: [PATCH] Exit when excessive drift workaround

Most probably on a concentrator hangup the excessive drift counter
permanently increases. Under that condition exit the process.

Signed-off-by: Frank Kunz <mailinglists@kunz-im-inter.net>
---
 src/timesync.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/timesync.c b/src/timesync.c
index 0000216..90d7c7f 100644
--- a/src/timesync.c
+++ b/src/timesync.c
@@ -231,6 +231,10 @@ ustime_t ts_updateTimesync (u1_t txunit, int quality, const timesync_t* curr) {
         }
         if( stats->excessive_drift_cnt >= 2*QUICK_RETRIES )
             stats->drift_thres = MAX_MCU_DRIFT_THRES;  // reset - we might be stuck on a very low value
+        if( stats->excessive_drift_cnt >= 20*QUICK_RETRIES ) {
+            LOG(MOD_SYN|CRITICAL, "excessive_drift_cnt too high! Concentrator hangup? Exit now.");
+            exit(EXIT_FAILURE);
+        }
         return TIMESYNC_RADIO_INTV/2;
     }
     stats->excessive_drift_cnt = 0;
-- 
2.30.1

openSUSE Build Service is sponsored by