From 77abfa98c36000caaa5790a2097e198d8a2583e2 Mon Sep 17 00:00:00 2001 From: ryanpj Date: Tue, 4 Dec 2018 09:05:34 +1100 Subject: [PATCH] Fix for #356 Reset frame when checkframe fails as it is impossible to know what is a valid start packet if CRC or mid frame is in buffer. --- pymodbus/framer/rtu_framer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pymodbus/framer/rtu_framer.py b/pymodbus/framer/rtu_framer.py index 4c343dbf9..ef0c52159 100644 --- a/pymodbus/framer/rtu_framer.py +++ b/pymodbus/framer/rtu_framer.py @@ -217,10 +217,11 @@ def processIncomingPacket(self, data, callback, unit, **kwargs): if self.checkFrame(): if self._validate_unit_id(unit, single): self._process(callback) + return else: _logger.debug("Not a valid unit id - {}, " "ignoring!!".format(self._header['uid'])) - self.resetFrame() + self.resetFrame() else: _logger.debug("Frame - [{}] not ready".format(data))