From 6ecbaa6da1df9db83dfef25afaa45376e2eeac64 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Tue, 1 Oct 2024 08:42:34 +0200 Subject: [PATCH] Fixed timeout logic --- .../Library/RemoteControl/KeepRemoteConnection.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Duplicati/Library/RemoteControl/KeepRemoteConnection.cs b/Duplicati/Library/RemoteControl/KeepRemoteConnection.cs index 74e3dba13..1018f3264 100644 --- a/Duplicati/Library/RemoteControl/KeepRemoteConnection.cs +++ b/Duplicati/Library/RemoteControl/KeepRemoteConnection.cs @@ -46,6 +46,11 @@ public class KeepRemoteConnection : IDisposable /// private static readonly TimeSpan ReconnectInterval = TimeSpan.FromSeconds(30); + /// + /// The interval between reconnect attempts + /// + private static readonly TimeSpan NoResponseTimeout = TimeSpan.FromSeconds(30); + /// /// The interval between heartbeats /// @@ -179,9 +184,8 @@ public class KeepRemoteConnection : IDisposable /// private Task RunMainLoop() { - //TODO: If we close the socket, it reconnects immediately - // casuing excessive usage - _client.ReconnectTimeout = ReconnectInterval; + _client.ReconnectTimeout = NoResponseTimeout; + _client.LostReconnectTimeout = ReconnectInterval; _client.IsReconnectionEnabled = true; _client.DisconnectionHappened.Subscribe(info =>