summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDenton Gentry <dgentry@tailscale.com>2021-01-11 13:34:51 -0800
committerDenton Gentry <denny@geekhold.com>2021-01-12 04:29:28 -0800
commit8349e10907dbee2cf708b2d8398f6c0ee79f3c06 (patch)
tree383d80cd7ec1be5fb41c2aaf4e71f63e1d907c9c
parentb771a1363b90930619dcb85e6cf154566d286722 (diff)
downloadtailscale-8349e10907dbee2cf708b2d8398f6c0ee79f3c06.tar.xz
tailscale-8349e10907dbee2cf708b2d8398f6c0ee79f3c06.zip
magicsock: add description of testClosingContext
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
-rw-r--r--wgengine/magicsock/magicsock_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/wgengine/magicsock/magicsock_test.go b/wgengine/magicsock/magicsock_test.go
index 794d01e7a..4aac0cdad 100644
--- a/wgengine/magicsock/magicsock_test.go
+++ b/wgengine/magicsock/magicsock_test.go
@@ -543,6 +543,11 @@ func TestDeviceStartStop(t *testing.T) {
dev.Close()
}
+// A context used in TestConnClosing() which seeks to test that code which calls
+// Err() to see if a connection is already being closed does not then proceed to
+// try to acquire the mutex, as this would lead to deadlock. When Err() is called
+// this context acquires the lock itself, in order to force a deadlock (and test
+// failure on timeout).
type testConnClosingContext struct {
parent context.Context
mu *sync.Mutex