mirror of
https://github.com/craigerl/aprsd.git
synced 2024-12-20 08:31:11 -05:00
Fixed issue of aprs-is missing keepalive
Started noticing that aprs-is keepalive messages just stop getting sent. This causes aprsd to basically disconnect from the APRS network. Added a check into the KeepAlive thread to restart the aprs-is connecter if the last time we got a keepalive from apris is > 5 minutes.
This commit is contained in:
parent
69b215d4d8
commit
560e152742
@ -89,6 +89,8 @@ class KeepAliveThread(APRSDThread):
|
|||||||
tracemalloc.start()
|
tracemalloc.start()
|
||||||
super().__init__("KeepAlive")
|
super().__init__("KeepAlive")
|
||||||
self.config = config
|
self.config = config
|
||||||
|
max_timeout = {"hours": 0.0, "minutes": 5, "seconds": 0}
|
||||||
|
self.max_delta = datetime.timedelta(**max_timeout)
|
||||||
|
|
||||||
def loop(self):
|
def loop(self):
|
||||||
if self.cntr % 60 == 0:
|
if self.cntr % 60 == 0:
|
||||||
@ -126,6 +128,19 @@ class KeepAliveThread(APRSDThread):
|
|||||||
len(thread_list),
|
len(thread_list),
|
||||||
)
|
)
|
||||||
LOG.info(keepalive)
|
LOG.info(keepalive)
|
||||||
|
|
||||||
|
# See if we should reset the aprs-is client
|
||||||
|
# Due to losing a keepalive from them
|
||||||
|
delta_dict = utils.parse_delta_str(last_msg_time)
|
||||||
|
delta = datetime.timedelta(**delta_dict)
|
||||||
|
|
||||||
|
if delta > self.max_delta:
|
||||||
|
# We haven't gotten a keepalive from aprs-is in a while
|
||||||
|
# reset the connection.a
|
||||||
|
if not kissclient.KISSClient.kiss_enabled(self.config):
|
||||||
|
LOG.warning("Resetting connection to APRS-IS.")
|
||||||
|
client.Client().reset()
|
||||||
|
|
||||||
# Check version every hour
|
# Check version every hour
|
||||||
delta = now - self.checker_time
|
delta = now - self.checker_time
|
||||||
if delta > datetime.timedelta(hours=1):
|
if delta > datetime.timedelta(hours=1):
|
||||||
|
Loading…
Reference in New Issue
Block a user