Skip to content

Commit

Permalink
Merge 3.6.8 effects.
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Apr 14, 2024
1 parent 681fd2c commit e9c187e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pymodbus/client/base.py
Expand Up @@ -167,14 +167,14 @@ async def async_execute(self, request) -> ModbusResponse:
async with self._lock:
req = self.build_response(request.transaction_id)
if not count or not self.no_resend_on_retry:
self.framer.resetFrame()
self.send(packet)
self.ctx.framer.resetFrame()
self.ctx.send(packet)
if self.broadcast_enable and not request.slave_id:
resp = None
break
try:
resp = await asyncio.wait_for(
req, timeout=self.comm_params.timeout_connect
req, timeout=self.ctx.comm_params.timeout_connect
)
break
except asyncio.exceptions.TimeoutError:
Expand Down
6 changes: 3 additions & 3 deletions pymodbus/framer/socket.py
Expand Up @@ -15,7 +15,7 @@ class FramerSocket(FramerBase):
* length = uid + function code + data
"""

MIN_SIZE = 9
MIN_SIZE = 8

def decode(self, data: bytes) -> tuple[int, int, int, bytes]:
"""Decode ADU."""
Expand All @@ -28,8 +28,8 @@ def decode(self, data: bytes) -> tuple[int, int, int, bytes]:
if used_len < msg_len:
Log.debug("Short frame: {} wait for more data", data, ":hex")
return 0, 0, 0, self.EMPTY
if msg_len == 2 and used_len >= self.MIN_SIZE:
msg_len = 3
if msg_len == 8 and used_len == 9:
msg_len = 9
return msg_len, msg_tid, msg_dev, data[7:msg_len]

def encode(self, pdu: bytes, device_id: int, tid: int) -> bytes:
Expand Down

0 comments on commit e9c187e

Please sign in to comment.