diff options
author | Josh Bleecher Snyder <josh@tailscale.com> | 2020-12-18 16:32:46 -0800 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-07 14:49:44 +0100 |
commit | b42e32047d16cc4389ef63550e525c7b08320172 (patch) | |
tree | 3321c5f3bce9fded5c598923f167bc2273535734 /device/device_test.go | |
parent | b5f966ac2439df9eba182886406f6381934948ad (diff) |
device: call wg.Add outside the goroutine
One of the first rules of WaitGroups is that you call wg.Add
outside of a goroutine, not inside it. Fix this embarrassing mistake.
This prevents an extremely rare race condition (2 per 100,000 runs)
which could occur when attempting to start a new peer
concurrently with shutting down a device.
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
Diffstat (limited to 'device/device_test.go')
0 files changed, 0 insertions, 0 deletions