Skip to content

Commit

Permalink
Transaction id overrun.
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Apr 23, 2024
1 parent a48aeeb commit 39cc9ff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pymodbus/transaction.py
Expand Up @@ -451,7 +451,7 @@ def getTransaction(self, tid):
"""
Log.debug("Getting transaction {}", tid)
if tid is None:
if not tid:
if self.transactions:
return self.transactions.popitem()[1]
return None
Expand All @@ -473,7 +473,10 @@ def getNextTID(self):
:returns: The next unique transaction identifier
"""
self.tid = (self.tid + 1) & 0xFFFF
if self.tid < 65000:
self.tid += 1
else:
self.tid = 1
return self.tid

def reset(self):
Expand Down

0 comments on commit 39cc9ff

Please sign in to comment.