diff --git a/pymodbus/framer/old_framer_base.py b/pymodbus/framer/old_framer_base.py index b35da6d53..4922be1c4 100644 --- a/pymodbus/framer/old_framer_base.py +++ b/pymodbus/framer/old_framer_base.py @@ -138,6 +138,8 @@ def processIncomingPacket(self, data, callback, slave, **kwargs): """ Log.debug("Processing: {}", data, ":hex") self._buffer += data + if self._buffer == b'': + return if not isinstance(slave, (list, tuple)): slave = [slave] single = kwargs.pop("single", False) diff --git a/pymodbus/framer/old_framer_socket.py b/pymodbus/framer/old_framer_socket.py index 4bd36f3f7..bc515ab2a 100644 --- a/pymodbus/framer/old_framer_socket.py +++ b/pymodbus/framer/old_framer_socket.py @@ -72,6 +72,8 @@ def frameProcessIncomingPacket(self, single, callback, slave, tid=None, **kwargs function to process and send. """ while True: + if self._buffer == b'': + return used_len, use_tid, dev_id, data = self.message_handler.decode(self._buffer) if not data: return