From 3c6ef1c5314980d9f01529ef95a6500bf43cc30a Mon Sep 17 00:00:00 2001 From: "Bruno Martins (bjm)" <59831763+bmartins-unit@users.noreply.github.com> Date: Wed, 1 Apr 2026 18:06:03 +0100 Subject: [PATCH] fix-keepalive-timeout --- share/tunnel/tunnel.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/share/tunnel/tunnel.go b/share/tunnel/tunnel.go index 7493a5ac..48c974c9 100644 --- a/share/tunnel/tunnel.go +++ b/share/tunnel/tunnel.go @@ -174,17 +174,14 @@ func (t *Tunnel) BindRemotes(ctx context.Context, remotes []*settings.Remote) er func (t *Tunnel) keepAliveLoop(sshConn ssh.Conn) { //ping forever - - //reply_timeout set to KeepAlive interval, if KeepAlive is less than 10s, set reply_timeout to 10s - //maybe a new config option for reply_timeout is also fine - reply_timeout := t.Config.KeepAlive - - if reply_timeout < 10*time.Second { - reply_timeout = 10 * time.Second + keepAliveInterval := t.Config.KeepAlive + if keepAliveInterval < 5*time.Second { + keepAliveInterval = 5 * time.Second } + reply_timeout := 2 * time.Second for { - time.Sleep(t.Config.KeepAlive) + time.Sleep(keepAliveInterval) errChannel := make(chan error, 2)