Skip to content

Commit 34a310c

Browse files
committed
chore: Code cleanup
1 parent 994f47f commit 34a310c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

internal/bridge/clean.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ func Clean() {
9090
default:
9191
_, _, err := tunnel.SshClient.SendRequest("[email protected]", true, nil)
9292
if err != nil {
93-
tunnel.SshClient.Close()
93+
if tunnel.SshClient != nil {
94+
tunnel.SshClient.Close()
95+
}
9496
closeTunnel(tunnel, key)
9597
logger.Sugar().Warnw("error when sending request")
9698
}

internal/bridge/ssh_tunnel.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ func (t *Tunnel) Start() {
5555
func (t *Tunnel) Stop() {
5656
t.Started = false
5757
t.log.Infow("collapsed tunnel", "details", t)
58-
t.SshClient.Conn.Close()
59-
t.SshClient.Close()
58+
if t.SshClient != nil {
59+
t.SshClient.Close()
60+
}
6061
t.cancel()
6162
}
6263

0 commit comments

Comments
 (0)