mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-28 04:26:26 -08:00
Fix potential goroutine leak in syncs/watchdog.go
Depending on how the preemption will occur, in some scenarios sendc would have blocked indefinitely even after cancelling the context. Fixes #10315 Signed-off-by: Uri Gorelik <[email protected]>
This commit is contained in:
1 parent
e7cad78b00
commit
b88929edf8
1 file changed
+4
-1
+4
-1
@@ -29,7 +29,10 @@ func Watch(ctx context.Context, mu sync.Locker, tick, max time.Duration) chan ti
|
||||
// Drop values written after c is closed.
|
||||
return
|
||||
}
|
||||
c <- d
|
||||
select {
|
||||
case c <- d:
|
||||
case <-ctx.Done():
|
||||
}
|
||||
}
|
||||
closec := func() {
|
||||
closemu.Lock()
|
||||
|
||||
Reference in new issue
Block a user