aboutsummaryrefslogtreecommitdiff
path: root/device/device_test.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josh@tailscale.com>2020-12-14 15:28:52 -0800
committerJason A. Donenfeld <Jason@zx2c4.com>2021-01-07 14:49:44 +0100
commit63066ce4062a85224821ce302e3eb8c34e95a658 (patch)
treef6945216e1b48bc5404f612cdcc5564b12e93aae /device/device_test.go
parente1fa1cc5560020e67d33aa7e74674853671cf0a0 (diff)
downloadwireguard-go-63066ce4062a85224821ce302e3eb8c34e95a658.tar.gz
wireguard-go-63066ce4062a85224821ce302e3eb8c34e95a658.zip
device: fix persistent_keepalive_interval data races
Co-authored-by: David Anderson <danderson@tailscale.com> Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
Diffstat (limited to 'device/device_test.go')
-rw-r--r--device/device_test.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/device/device_test.go b/device/device_test.go
index 65942ec..e143914 100644
--- a/device/device_test.go
+++ b/device/device_test.go
@@ -215,7 +215,20 @@ func TestConcurrencySafety(t *testing.T) {
}()
warmup.Wait()
- // coming soon: more things here...
+ // Change persistent_keepalive_interval concurrently with tunnel use.
+ t.Run("persistentKeepaliveInterval", func(t *testing.T) {
+ cfg := uapiCfg(
+ "public_key", "f70dbb6b1b92a1dde1c783b297016af3f572fef13b0abb16a2623d89a58e9725",
+ "persistent_keepalive_interval", "1",
+ )
+ for i := 0; i < 1000; i++ {
+ cfg.Seek(0, io.SeekStart)
+ err := pair[0].dev.IpcSetOperation(cfg)
+ if err != nil {
+ t.Fatal(err)
+ }
+ }
+ })
close(done)
}