Skip to content

Commit 5690c72

Browse files
committed
Fix/Workaround for #612, #614 , avoid disconnects on succesful reads
1 parent 1da8e5e commit 5690c72

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

CHANGELOG.rst

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ version 2.5.1
33
* Bug fix TCP Repl server.
44
* Support multiple UID's with REPL server.
55
* Support serial for URL (sync serial client)
6+
* Bug fix/enhancements, close socket connections only on empty or invalid response
67

78
version 2.5.0
89
----------------------------------------------------------

pymodbus/transaction.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -217,19 +217,21 @@ def execute(self, request):
217217
"/Unable to decode response")
218218
response = ModbusIOException(last_exception,
219219
request.function_code)
220+
self.client.close()
220221
if hasattr(self.client, "state"):
221222
_logger.debug("Changing transaction state from "
222223
"'PROCESSING REPLY' to "
223224
"'TRANSACTION_COMPLETE'")
224225
self.client.state = (
225226
ModbusTransactionState.TRANSACTION_COMPLETE)
226-
self.client.close()
227+
227228
return response
228229
except ModbusIOException as ex:
229230
# Handle decode errors in processIncomingPacket method
230231
_logger.exception(ex)
231232
self.client.close()
232233
self.client.state = ModbusTransactionState.TRANSACTION_COMPLETE
234+
self.client.close()
233235
return ex
234236

235237
def _retry_transaction(self, retries, reason,

pymodbus/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __str__(self):
4141
return '[%s, version %s]' % (self.package, self.short())
4242

4343

44-
version = Version('pymodbus', 2, 5, 1)
44+
version = Version('pymodbus', 2, 5, 1, "rc1")
4545

4646
version.__name__ = 'pymodbus' # fix epydoc error
4747

0 commit comments

Comments
 (0)