Skip to content

Commit

Permalink
chore: Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dogukanoksuz committed May 24, 2023
1 parent 994f47f commit 34a310c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion internal/bridge/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ func Clean() {
default:
_, _, err := tunnel.SshClient.SendRequest("keepalive@openssh.com", true, nil)
if err != nil {
tunnel.SshClient.Close()
if tunnel.SshClient != nil {
tunnel.SshClient.Close()
}
closeTunnel(tunnel, key)
logger.Sugar().Warnw("error when sending request")
}
Expand Down
5 changes: 3 additions & 2 deletions internal/bridge/ssh_tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ func (t *Tunnel) Start() {
func (t *Tunnel) Stop() {
t.Started = false
t.log.Infow("collapsed tunnel", "details", t)
t.SshClient.Conn.Close()
t.SshClient.Close()
if t.SshClient != nil {
t.SshClient.Close()
}
t.cancel()
}

Expand Down

0 comments on commit 34a310c

Please sign in to comment.