Skip to content

Commit c15b0b0

Browse files
committed
fix time out
1 parent 4c14a76 commit c15b0b0

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

share/tunnel/tunnel.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,15 @@ func (t *Tunnel) BindRemotes(ctx context.Context, remotes []*settings.Remote) er
175175
func (t *Tunnel) keepAliveLoop(sshConn ssh.Conn) {
176176
//ping forever
177177

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
178+
reply_timeout := 2 * time.Second
181179

182-
if reply_timeout < 10*time.Second {
183-
reply_timeout = 10 * time.Second
180+
keepAliveInterval := t.Config.KeepAlive
181+
if keepAliveInterval < 5*time.Second {
182+
keepAliveInterval = 5 * time.Second
184183
}
185184

186185
for {
187-
time.Sleep(t.Config.KeepAlive)
186+
time.Sleep(keepAliveInterval)
188187

189188
errChannel := make(chan error, 2)
190189

0 commit comments

Comments
 (0)