Skip to content

Commit

Permalink
Speed up no data detection. (#2150)
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Apr 5, 2024
1 parent 210ad31 commit a6b43dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pymodbus/framer/old_framer_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions pymodbus/framer/old_framer_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a6b43dd

Please sign in to comment.