File tree 4 files changed +348
-6
lines changed
4 files changed +348
-6
lines changed Original file line number Diff line number Diff line change @@ -1485,9 +1485,6 @@ func (api *API) Close() error {
1485
1485
default :
1486
1486
api .cancel ()
1487
1487
}
1488
- if api .derpCloseFunc != nil {
1489
- api .derpCloseFunc ()
1490
- }
1491
1488
1492
1489
wsDone := make (chan struct {})
1493
1490
timer := time .NewTimer (10 * time .Second )
@@ -1513,11 +1510,16 @@ func (api *API) Close() error {
1513
1510
api .updateChecker .Close ()
1514
1511
}
1515
1512
_ = api .workspaceAppServer .Close ()
1513
+ _ = api .agentProvider .Close ()
1514
+ if api .derpCloseFunc != nil {
1515
+ api .derpCloseFunc ()
1516
+ }
1517
+ // The coordinator should be closed after the agent provider, and the DERP
1518
+ // handler.
1516
1519
coordinator := api .TailnetCoordinator .Load ()
1517
1520
if coordinator != nil {
1518
1521
_ = (* coordinator ).Close ()
1519
1522
}
1520
- _ = api .agentProvider .Close ()
1521
1523
_ = api .statsReporter .Close ()
1522
1524
_ = api .NetworkTelemetryBatcher .Close ()
1523
1525
_ = api .OIDCConvertKeyCache .Close ()
Original file line number Diff line number Diff line change @@ -75,7 +75,8 @@ func NewServerTailnet(
75
75
// given in this callback, it's only valid while connecting.
76
76
if derpServer != nil {
77
77
conn .SetDERPRegionDialer (func (_ context.Context , region * tailcfg.DERPRegion ) net.Conn {
78
- if ! region .EmbeddedRelay {
78
+ // Don't set up the embedded relay if we're shutting down
79
+ if ! region .EmbeddedRelay || ctx .Err () != nil {
79
80
return nil
80
81
}
81
82
logger .Debug (ctx , "connecting to embedded DERP via in-memory pipe" )
You can’t perform that action at this time.
0 commit comments