From ef206b12837738779bfda5beb1ccfb0edbf38649 Mon Sep 17 00:00:00 2001 From: Hemna Date: Thu, 14 Sep 2023 16:46:00 -0400 Subject: [PATCH] Ensure Keepalive doesn't reset client at startup This patch ensures that the keepalive thread doesn't try and reset/restart the aprs connection at startup. --- aprsd/threads/keep_alive.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aprsd/threads/keep_alive.py b/aprsd/threads/keep_alive.py index 9ea3282..940802d 100644 --- a/aprsd/threads/keep_alive.py +++ b/aprsd/threads/keep_alive.py @@ -82,7 +82,12 @@ class KeepAliveThread(APRSDThread): # check the APRS connection cl = client.factory.create() - if not cl.is_alive(): + # Reset the connection if it's dead and this isn't our + # First time through the loop. + # The first time through the loop can happen at startup where + # The keepalive thread starts before the client has a chance + # to make it's connection the first time. + if not cl.is_alive() and self.cntr > 0: LOG.error(f"{cl.__class__.__name__} is not alive!!! Resetting") client.factory.create().reset() else: