fix error where stopping the modem wasnt possible

This commit is contained in:
DJ2LS 2023-10-23 20:55:22 +02:00
parent 9cb5134737
commit 4d40b59303
2 changed files with 8 additions and 3 deletions

View file

@ -46,7 +46,7 @@ function connectModem() {
client.on("connect", function () {
console.log("Modem connection established");
stateStore.modem_running_state = "running"
stateStore.busy_state = "-";
stateStore.arq_state = "-";
stateStore.frequency = "-";
@ -63,7 +63,11 @@ client.on("error", function (err) {
console.log("Modem connection error");
console.log(err);
modemShowConnectStateError = 0;
stateStore.modem_running_state = "stopped"
}
setTimeout(connectModem, 500);
client.destroy();
stateStore.busy_state = "-";
@ -93,6 +97,7 @@ client.on("end", function (data) {
stateStore.dbfs_level = 0;
stateStore.updateTncState(client.readyState);
client.destroy();
stateStore.modem_running_state = "stopped"
setTimeout(connectModem, 500);
});

View file

@ -1128,12 +1128,12 @@ class ThreadedTCPRequestHandler(socketserver.StreamRequestHandler):
def daemon_stop_modem(self, received_json):
try:
log.warning("[SCK] Stopping Modem")
Daemon.modemstarted = False
Daemon.modemprocess.kill()
# unregister process from atexit to avoid process zombies
atexit.unregister(Daemon.modemprocess.kill)
log.warning("[SCK] Stopping Modem")
Daemon.modemstarted = False
command_response("stop_modem", True)
except Exception as err:
command_response("stop_modem", False)