disallow disconnect when disconnected, disconnecting, failed #289

This commit is contained in:
DJ2LS 2022-11-20 18:19:56 +01:00
parent 166bb6aba4
commit bd198d7c67

View file

@ -360,11 +360,19 @@ def process_tnc_commands(data):
# DISCONNECT ----------------------------------------------------------
if received_json["type"] == "arq" and received_json["command"] == "disconnect":
try:
DATA_QUEUE_TRANSMIT.put(["DISCONNECT"])
if not static.ARQ_SESSION_STATE in ["disconnecting", "disconnected", "failed"]:
DATA_QUEUE_TRANSMIT.put(["DISCONNECT"])
# set early disconnecting state so we can interrupt connection attempts
static.ARQ_SESSION_STATE = "disconnecting"
command_response("disconnect", True)
# set early disconnecting state so we can interrupt connection attempts
static.ARQ_SESSION_STATE = "disconnecting"
command_response("disconnect", True)
else:
command_response("disconnect", False)
log.warning(
"[SCK] Disconnect command not possible",
state=static.ARQ_SESSION_STATE,
command=received_json,
)
except Exception as err:
command_response("disconnect", False)
log.warning(