From 2cb7ee789376c6868c4ebc0c1a96d0c8b966ab69 Mon Sep 17 00:00:00 2001 From: dj2ls Date: Thu, 29 Dec 2022 19:16:47 +0100 Subject: [PATCH] attempt avoiding connecting while already connected --- tnc/data_handler.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tnc/data_handler.py b/tnc/data_handler.py index 7bd724f7..ebc666e6 100644 --- a/tnc/data_handler.py +++ b/tnc/data_handler.py @@ -1622,6 +1622,15 @@ class DATA: if not static.RESPOND_TO_CALL: return False + # ignore channel opener if already in ARQ STATE + # use case: Station A is connecting to Station B while + # Station B already tries connecting to Station A. + # For avoiding ignoring repeated connect request in case of packet loss + # we are only ignoring packets in case we are ISS + if static.ARQ_SESSION and not self.IS_ARQ_SESSION_MASTER: + return False + + self.IS_ARQ_SESSION_MASTER = False static.ARQ_SESSION_STATE = "connecting" @@ -2043,6 +2052,14 @@ class DATA: # check if callsign ssid override _, self.mycallsign = helpers.check_callsign(self.mycallsign, data_in[1:4]) + # ignore channel opener if already in ARQ STATE + # use case: Station A is connecting to Station B while + # Station B already tries connecting to Station A. + # For avoiding ignoring repeated connect request in case of packet loss + # we are only ignoring packets in case we are ISS + if static.ARQ_STATE and not self.is_IRS: + return False + static.DXCALLSIGN_CRC = bytes(data_in[4:7]) self.dxcallsign = helpers.bytes_to_callsign(bytes(data_in[7:13])) static.DXCALLSIGN = self.dxcallsign