diff --git a/tnc/data_handler.py b/tnc/data_handler.py index 5ba7d804..6de5d235 100644 --- a/tnc/data_handler.py +++ b/tnc/data_handler.py @@ -1659,6 +1659,7 @@ class DATA: status="failed", reason="busy", ) + static.ARQ_SESSION_STATE = "disconnected" return False self.arq_open_data_channel(mode, n_frames_per_burst, mycallsign) diff --git a/tnc/sock.py b/tnc/sock.py index 20b79880..915f4770 100644 --- a/tnc/sock.py +++ b/tnc/sock.py @@ -325,7 +325,7 @@ def process_tnc_commands(data): dxcallsign = helpers.callsign_to_bytes(dxcallsign) dxcallsign = helpers.bytes_to_callsign(dxcallsign) - if static.ARQ_SESSION_STATE != "disconnected": + if static.ARQ_SESSION_STATE not in ["disconnected", "failed"]: command_response("connect", False) log.warning( "[SCK] Connect command execution error", @@ -335,35 +335,28 @@ def process_tnc_commands(data): else: # finally check again if we are disconnected or failed - if static.ARQ_SESSION_STATE == 'disconnected' or static.ARQ_SESSION_STATE == 'failed': - # try connecting - try: - static.DXCALLSIGN = dxcallsign - static.DXCALLSIGN_CRC = helpers.get_crc_24(static.DXCALLSIGN) + # try connecting + try: + static.DXCALLSIGN = dxcallsign + static.DXCALLSIGN_CRC = helpers.get_crc_24(static.DXCALLSIGN) - DATA_QUEUE_TRANSMIT.put(["CONNECT", dxcallsign, attempts]) - command_response("connect", True) - except Exception as err: - command_response("connect", False) - log.warning( - "[SCK] Connect command execution error", - e=err, - command=received_json, - ) - # allow beacon transmission again - static.BEACON_PAUSE = False - - else: + DATA_QUEUE_TRANSMIT.put(["CONNECT", dxcallsign, attempts]) + command_response("connect", True) + except Exception as err: command_response("connect", False) log.warning( "[SCK] Connect command execution error", - e="connection still exists", + e=err, command=received_json, ) # allow beacon transmission again static.BEACON_PAUSE = False + + # allow beacon transmission again + static.BEACON_PAUSE = False + # DISCONNECT ---------------------------------------------------------- if received_json["type"] == "arq" and received_json["command"] == "disconnect": try: