From 687608a5fad9fe4a7e6c3b7e9a717a2d15aaab9c Mon Sep 17 00:00:00 2001 From: Adam Crain Date: Tue, 2 Aug 2022 17:01:26 -0700 Subject: [PATCH] reset TCP connection logic when a successful connection happens (#83) --- CHANGELOG.md | 1 + rodbus/src/tcp/client.rs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index be94f0bb..d7d19bc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * Add RTU support. See [#56](https://github.com/stepfunc/rodbus/pull/56). * Dynamic protocol decoding. See [#61](https://github.com/stepfunc/rodbus/pull/66). * Resolve host names on client. See [#68](https://github.com/stepfunc/rodbus/pull/68). +* Properly reset TCP connection retry timeout on success. See [#82](https://github.com/stepfunc/rodbus/issues/82). ### 0.9.1 ### * Client callbacks are now not blocking. diff --git a/rodbus/src/tcp/client.rs b/rodbus/src/tcp/client.rs index 1fa8f9a2..546bd8af 100644 --- a/rodbus/src/tcp/client.rs +++ b/rodbus/src/tcp/client.rs @@ -125,6 +125,10 @@ impl TcpChannelTask { } } Ok(mut phys) => { + // reset the retry strategy now that we have a successful connection + // we do this here so that the reset happens after a TLS handshake + self.connect_retry.reset(); + // run the physical layer independent processing loop match self.client_loop.run(&mut phys).await { // the mpsc was closed, end the task SessionError::Shutdown => return Shutdown,