From 8349e10907dbee2cf708b2d8398f6c0ee79f3c06 Mon Sep 17 00:00:00 2001 From: Denton Gentry Date: Mon, 11 Jan 2021 13:34:51 -0800 Subject: [PATCH] magicsock: add description of testClosingContext Signed-off-by: Denton Gentry --- wgengine/magicsock/magicsock_test.go | 5 +++++ 1 file changed, 5 insertions(+) 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