Skip to content

Commit 3c6ef1c

Browse files
fix-keepalive-timeout
1 parent 4c14a76 commit 3c6ef1c

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

share/tunnel/tunnel.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,14 @@ func (t *Tunnel) BindRemotes(ctx context.Context, remotes []*settings.Remote) er
174174

175175
func (t *Tunnel) keepAliveLoop(sshConn ssh.Conn) {
176176
//ping forever
177-
178-
//reply_timeout set to KeepAlive interval, if KeepAlive is less than 10s, set reply_timeout to 10s
179-
//maybe a new config option for reply_timeout is also fine
180-
reply_timeout := t.Config.KeepAlive
181-
182-
if reply_timeout < 10*time.Second {
183-
reply_timeout = 10 * time.Second
177+
keepAliveInterval := t.Config.KeepAlive
178+
if keepAliveInterval < 5*time.Second {
179+
keepAliveInterval = 5 * time.Second
184180
}
185181

182+
reply_timeout := 2 * time.Second
186183
for {
187-
time.Sleep(t.Config.KeepAlive)
184+
time.Sleep(keepAliveInterval)
188185

189186
errChannel := make(chan error, 2)
190187

0 commit comments

Comments
 (0)