Skip to content

Commit

Permalink
network-tunnel: Don't fail on Stop() of nil tunnel
Browse files Browse the repository at this point in the history
Currently `source-oracle` does an unconditional `db.tunnel.Stop()`
during shutdown regardless of whether a network tunnel exists, but
the implementation of `Stop()` assumes that the tunnel must not be
nil. This disagreement could be resolved in either direction, but
it seemed cleaner to just make `Stop()` a no-op for nil receivers.
  • Loading branch information
willdonnelly committed Dec 3, 2024
1 parent c3518cc commit 204a423
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions go/network-tunnel/network_tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ func (t *SshTunnel) Start() error {
}

func (t *SshTunnel) Stop() {
if t == nil {
return
}
if t.Cmd != nil {
// Using the negative pid signals kill to a process group.
// This ensures the children of the process are also killed
Expand Down

0 comments on commit 204a423

Please sign in to comment.