Skip to content

Commit 38c7ec1

Browse files
committed
fix: Close coordinator on context cancellation
1 parent 4183c5e commit 38c7ec1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

agent/agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,12 @@ func (a *agent) runCoordinator(ctx context.Context) {
291291
a.logger.Info(context.Background(), "connected to coordination server")
292292
break
293293
}
294+
defer coordinator.Close()
294295
select {
295296
case <-ctx.Done():
296297
return
297298
default:
298299
}
299-
defer coordinator.Close()
300300
sendNodes, errChan := tailnet.ServeCoordinator(coordinator, a.network.UpdateNodes)
301301
a.network.SetNodeCallback(sendNodes)
302302
select {

0 commit comments

Comments
 (0)