don't send AT or Modbus cmds on closed connections

This commit is contained in:
Stefan Allius
2024-05-07 18:32:56 +02:00
parent 39beb0cb44
commit 02d9f01947
3 changed files with 8 additions and 4 deletions

View File

@@ -45,6 +45,7 @@ class Talent(Message):
self.db = InfosG3()
self.mb = Modbus()
self.forward_modbus_resp = False
self.closed = False
self.switch = {
0x00: self.msg_contact_info,
0x13: self.msg_ota_update,
@@ -66,6 +67,7 @@ class Talent(Message):
# so we have to erase self.switch, otherwise this instance can't be
# deallocated by the garbage collector ==> we get a memory leak
self.switch.clear()
self.closed = True
def __set_serial_no(self, serial_no: str):