Skip to content

Commit 9b5d627

Browse files
authored
fix(tailnet): data race in coordinator.Close() (#4589)
1 parent 29acd25 commit 9b5d627

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tailnet/coordinator.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,10 @@ func (c *coordinator) handleNextAgentMessage(id uuid.UUID, decoder *json.Decoder
338338
func (c *coordinator) Close() error {
339339
c.mutex.Lock()
340340
if c.closed {
341+
c.mutex.Unlock()
341342
return nil
342343
}
343344
c.closed = true
344-
c.mutex.Unlock()
345345

346346
wg := sync.WaitGroup{}
347347

@@ -365,6 +365,8 @@ func (c *coordinator) Close() error {
365365
}
366366
}
367367

368+
c.mutex.Unlock()
369+
368370
wg.Wait()
369371
return nil
370372
}

0 commit comments

Comments
 (0)