Use CLI context when running tunnel
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
5352b3cf04
commit
7f1fc77731
|
@ -274,7 +274,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