interrupt arq session while opening

This commit is contained in:
DJ2LS 2022-11-17 14:55:20 +01:00
parent 0326cf612a
commit cd9b8e5173
2 changed files with 10 additions and 1 deletions

View file

@ -1369,6 +1369,11 @@ class DATA:
if static.ARQ_SESSION:
return True
# Stop waiting and interrupt if data channel is getting closed while opening
if static.ARQ_SESSION_STATE == "disconnecting":
self.close_session()
return False
# Session connect timeout, send close_session frame to
# attempt to clean up the far-side, if it received the
# open_session frame and can still hear us.
@ -1444,6 +1449,8 @@ class DATA:
self.send_disconnect_frame()
self.arq_cleanup()
static.ARQ_SESSION_STATE = "disconnected"
def received_session_close(self, data_in: bytes):
"""
Closes the session when a close session frame is received and

View file

@ -332,9 +332,11 @@ def process_tnc_commands(data):
# DISCONNECT ----------------------------------------------------------
if received_json["type"] == "arq" and received_json["command"] == "disconnect":
# send ping frame and wait for ACK
try:
DATA_QUEUE_TRANSMIT.put(["DISCONNECT"])
# set early disconnecting state so we can interrupt connection attemtps
static.ARQ_SESSION_STATE = "disconnecting"
command_response("disconnect", True)
except Exception as err:
command_response("disconnect", False)