Skip to content

Commit

Permalink
Increase reconnection wait times
Browse files Browse the repository at this point in the history
  • Loading branch information
alebeck committed Feb 12, 2025
1 parent cf305a8 commit 87a2490
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions internal/tunnel/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import (
)

const (
reconnectWait = 2 * time.Millisecond
reconnectTimeout = 10 * time.Minute
initReconnectWait = 500 * time.Millisecond
maxReconnectWait = 1 * time.Minute
reconnectTimeout = 15 * time.Minute
keepAliveInterval = 2 * time.Minute
)

Expand Down Expand Up @@ -329,8 +330,8 @@ func (t *Tunnel) handleSocks() {
func (t *Tunnel) reconnectLoop() error {
t.Status = Reconn
timeout := time.After(reconnectTimeout)
wait := time.NewTimer(0.) // First time try immediately
waitTime := reconnectWait
wait := time.NewTimer(2 * time.Millisecond) // First time try (essent.) immediately
waitTime := initReconnectWait

for {
select {
Expand All @@ -348,6 +349,9 @@ func (t *Tunnel) reconnectLoop() error {
t.Name, err, waitTime)
wait.Reset(waitTime)
waitTime *= 2
if waitTime > maxReconnectWait {
waitTime = maxReconnectWait
}
}
}
}
Expand Down

0 comments on commit 87a2490

Please sign in to comment.