@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [unreleased]
|
## [unreleased]
|
||||||
|
|
||||||
|
- MODBUS close handler releases internal resource [#93](https://github.com/s-allius/tsun-gen3-proxy/issues/93)
|
||||||
- add exception handling for message forwarding [#94](https://github.com/s-allius/tsun-gen3-proxy/issues/94)
|
- add exception handling for message forwarding [#94](https://github.com/s-allius/tsun-gen3-proxy/issues/94)
|
||||||
- print imgae build time during proxy start
|
- print imgae build time during proxy start
|
||||||
- add type annotations
|
- add type annotations
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ class AsyncStream():
|
|||||||
"""Async loop handler for precessing all received messages"""
|
"""Async loop handler for precessing all received messages"""
|
||||||
self.r_addr = self.writer.get_extra_info('peername')
|
self.r_addr = self.writer.get_extra_info('peername')
|
||||||
self.l_addr = self.writer.get_extra_info('sockname')
|
self.l_addr = self.writer.get_extra_info('sockname')
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
await self.__async_read()
|
await self.__async_read()
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ class InverterG3(Inverter, ConnectionG3):
|
|||||||
def close(self) -> None:
|
def close(self) -> None:
|
||||||
logging.debug(f'InverterG3.close() l{self.l_addr} | r{self.r_addr}')
|
logging.debug(f'InverterG3.close() l{self.l_addr} | r{self.r_addr}')
|
||||||
super().close() # call close handler in the parent class
|
super().close() # call close handler in the parent class
|
||||||
# logger.debug (f'Inverter refs: {gc.get_referrers(self)}')
|
# logging.info(f'Inverter refs: {gc.get_referrers(self)}')
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
logging.debug("InverterG3.__del__")
|
logging.debug("InverterG3.__del__")
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class Message(metaclass=IterRegistry):
|
|||||||
'''
|
'''
|
||||||
def close(self) -> None:
|
def close(self) -> None:
|
||||||
if self.mb:
|
if self.mb:
|
||||||
del self.mb
|
self.mb.close()
|
||||||
self.mb = None
|
self.mb = None
|
||||||
pass # pragma: no cover
|
pass # pragma: no cover
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,16 @@ class Modbus():
|
|||||||
self.req_pend = False
|
self.req_pend = False
|
||||||
self.tim = None
|
self.tim = None
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""free the queue and erase the callback handlers"""
|
||||||
|
logging.debug('Modbus close:')
|
||||||
|
self.rsp_handler = None
|
||||||
|
self.snd_handler = None
|
||||||
|
while not self.que.empty:
|
||||||
|
self.que.get_nowait()
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
|
"""log statistics on the deleting of a MODBUS instance"""
|
||||||
logging.debug(f'Modbus __del__:\n {self.counter}')
|
logging.debug(f'Modbus __del__:\n {self.counter}')
|
||||||
|
|
||||||
def build_msg(self, addr: int, func: int, reg: int, val: int,
|
def build_msg(self, addr: int, func: int, reg: int, val: int,
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ if __name__ == "__main__":
|
|||||||
handle_shutdown(loop)))
|
handle_shutdown(loop)))
|
||||||
|
|
||||||
#
|
#
|
||||||
# Create taska for our listening servera. These must be tasks! If we call
|
# Create tasks for our listening servers. These must be tasks! If we call
|
||||||
# start_server directly out of our main task, the eventloop will be blocked
|
# start_server directly out of our main task, the eventloop will be blocked
|
||||||
# and we can't receive and handle the UNIX signals!
|
# and we can't receive and handle the UNIX signals!
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user