Use CLI context when running tunnel (#597)
When embedding the tunnel command inside another CLI, it became difficult to test shutdown behavior due to this leaking tunnel. By using the command context, we're able to shutdown gracefully.
This commit is contained in:
parent
9e1f4c2bca
commit
61a16538a1
|
@ -340,7 +340,7 @@ func StartServer(
|
|||
logClientOptions(c, log)
|
||||
|
||||
// this context drives the server, when it's cancelled tunnel and all other components (origins, dns, etc...) should stop
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ctx, cancel := context.WithCancel(c.Context)
|
||||
defer cancel()
|
||||
|
||||
go waitForSignal(graceShutdownC, log)
|
||||
|
|
Loading…
Reference in New Issue