Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pymodbus/framer/old_framer_rtu.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def is_frame_ready(self):
try:
self._header["uid"] = int(self._buffer[0])
self._header["tid"] = int(self._buffer[0])
self._header["tid"] = 0 # fix for now
func_code = int(self._buffer[1])
pdu_class = self.decoder.lookupPduClass(func_code)
size = pdu_class.calculateRtuFrameSize(self._buffer)
Expand Down Expand Up @@ -117,6 +118,7 @@ def check_frame(self):
try:
self._header["uid"] = int(self._buffer[0])
self._header["tid"] = int(self._buffer[0])
self._header["tid"] = 0 # fix for now
func_code = int(self._buffer[1])
pdu_class = self.decoder.lookupPduClass(func_code)
size = pdu_class.calculateRtuFrameSize(self._buffer)
Expand Down
4 changes: 3 additions & 1 deletion pymodbus/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,9 @@ def getTransaction(self, tid):
Log.debug("Getting transaction {}", tid)
if not tid:
if self.transactions:
return self.transactions.popitem()[1]
ret = self.transactions.popitem()[1]
self.transactions.clear()
return ret
return None
return self.transactions.pop(tid, None)

Expand Down
4 changes: 2 additions & 2 deletions test/framers/test_old_framers.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def callback(data):
"crc": b"\x49\xAD",
"uid": 17,
"len": 11,
"tid": 17,
"tid": 0,
},
),
(
Expand All @@ -225,7 +225,7 @@ def callback(data):
"crc": b"\x49\xAD",
"uid": 17,
"len": 11,
"tid": 17,
"tid": 0,
},
),
],
Expand Down