From 4abc3084459458f786d92214c2af8317b5bac9c1 Mon Sep 17 00:00:00 2001 From: Stefan Allius Date: Sun, 30 Jun 2024 00:27:58 +0200 Subject: [PATCH] fix exception in MODBUS timeout callback --- CHANGELOG.md | 2 ++ app/src/modbus.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0712696..4405439 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +- fix exception in MODBUS timeout callback + ## [0.9.0-RC1] - 2024-06-29 - add asyncio log and debug mode diff --git a/app/src/modbus.py b/app/src/modbus.py index 57eb272..7425b56 100644 --- a/app/src/modbus.py +++ b/app/src/modbus.py @@ -108,6 +108,7 @@ class Modbus(): def close(self): """free the queue and erase the callback handlers""" logging.debug('Modbus close:') + self.__stop_timer() self.rsp_handler = None self.snd_handler = None while not self.que.empty: @@ -252,6 +253,7 @@ class Modbus(): # logging.debug(f'Modbus stop timer {self}') if self.tim: self.tim.cancel() + self.tim = None def __timeout_cb(self) -> None: '''Rsponse timeout handler retransmit pdu or send next pdu'''