mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Merge pull request #495 from DJ2LS/ls-modem
fix error where stopping the modem wasnt possible
This commit is contained in:
commit
3bcb21326c
2 changed files with 6 additions and 3 deletions
|
@ -46,7 +46,7 @@ function connectModem() {
|
||||||
|
|
||||||
client.on("connect", function () {
|
client.on("connect", function () {
|
||||||
console.log("Modem connection established");
|
console.log("Modem connection established");
|
||||||
|
stateStore.modem_running_state = "running";
|
||||||
stateStore.busy_state = "-";
|
stateStore.busy_state = "-";
|
||||||
stateStore.arq_state = "-";
|
stateStore.arq_state = "-";
|
||||||
stateStore.frequency = "-";
|
stateStore.frequency = "-";
|
||||||
|
@ -63,7 +63,9 @@ client.on("error", function (err) {
|
||||||
console.log("Modem connection error");
|
console.log("Modem connection error");
|
||||||
console.log(err);
|
console.log(err);
|
||||||
modemShowConnectStateError = 0;
|
modemShowConnectStateError = 0;
|
||||||
|
stateStore.modem_running_state = "stopped";
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(connectModem, 500);
|
setTimeout(connectModem, 500);
|
||||||
client.destroy();
|
client.destroy();
|
||||||
stateStore.busy_state = "-";
|
stateStore.busy_state = "-";
|
||||||
|
@ -93,6 +95,7 @@ client.on("end", function (data) {
|
||||||
stateStore.dbfs_level = 0;
|
stateStore.dbfs_level = 0;
|
||||||
stateStore.updateTncState(client.readyState);
|
stateStore.updateTncState(client.readyState);
|
||||||
client.destroy();
|
client.destroy();
|
||||||
|
stateStore.modem_running_state = "stopped";
|
||||||
|
|
||||||
setTimeout(connectModem, 500);
|
setTimeout(connectModem, 500);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1128,12 +1128,12 @@ class ThreadedTCPRequestHandler(socketserver.StreamRequestHandler):
|
||||||
|
|
||||||
def daemon_stop_modem(self, received_json):
|
def daemon_stop_modem(self, received_json):
|
||||||
try:
|
try:
|
||||||
|
log.warning("[SCK] Stopping Modem")
|
||||||
|
Daemon.modemstarted = False
|
||||||
Daemon.modemprocess.kill()
|
Daemon.modemprocess.kill()
|
||||||
# unregister process from atexit to avoid process zombies
|
# unregister process from atexit to avoid process zombies
|
||||||
atexit.unregister(Daemon.modemprocess.kill)
|
atexit.unregister(Daemon.modemprocess.kill)
|
||||||
|
|
||||||
log.warning("[SCK] Stopping Modem")
|
|
||||||
Daemon.modemstarted = False
|
|
||||||
command_response("stop_modem", True)
|
command_response("stop_modem", True)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
command_response("stop_modem", False)
|
command_response("stop_modem", False)
|
||||||
|
|
Loading…
Reference in a new issue