Skip to content

Commit 4149f45

Browse files
fix: Tunnel doesn't stop on connection errors
1 parent f0b43db commit 4149f45

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

internal/bridge/ssh_tunnel.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ func (t *Tunnel) dialTunnel(ctx context.Context, wg *sync.WaitGroup, client *ssh
268268
defer cancel()
269269
if _, err := io.Copy(cn1, cn2); err != nil {
270270
once.Do(func() {
271+
t.Stop()
271272
t.errHandler()
272273
t.log.Errorw("connection error", "details", fmt.Sprintf("%v, %v", t, err))
273274
})
@@ -278,6 +279,7 @@ func (t *Tunnel) dialTunnel(ctx context.Context, wg *sync.WaitGroup, client *ssh
278279
defer cancel()
279280
if _, err := io.Copy(cn2, cn1); err != nil {
280281
once.Do(func() {
282+
t.Stop()
281283
t.errHandler()
282284
t.log.Errorw("connection error", "details", fmt.Sprintf("%v, %v", t, err))
283285
})

0 commit comments

Comments
 (0)