Skip to content

Commit

Permalink
fix: Tunnel doesn't stop on connection errors
Browse files Browse the repository at this point in the history
  • Loading branch information
zekiahmetbayar committed Nov 2, 2023
1 parent f0b43db commit 4149f45
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/bridge/ssh_tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ func (t *Tunnel) dialTunnel(ctx context.Context, wg *sync.WaitGroup, client *ssh
defer cancel()
if _, err := io.Copy(cn1, cn2); err != nil {
once.Do(func() {
t.Stop()
t.errHandler()
t.log.Errorw("connection error", "details", fmt.Sprintf("%v, %v", t, err))
})
Expand All @@ -278,6 +279,7 @@ func (t *Tunnel) dialTunnel(ctx context.Context, wg *sync.WaitGroup, client *ssh
defer cancel()
if _, err := io.Copy(cn2, cn1); err != nil {
once.Do(func() {
t.Stop()
t.errHandler()
t.log.Errorw("connection error", "details", fmt.Sprintf("%v, %v", t, err))
})
Expand Down

0 comments on commit 4149f45

Please sign in to comment.