mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00: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 <uri.gore@gmail.com>
This commit is contained in:
parent
e7cad78b00
commit
b88929edf8
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user