diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/net/fd_unix.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/net/fd_unix.go b/src/net/fd_unix.go index 40ecbef2e8..0d4303e2cc 100644 --- a/src/net/fd_unix.go +++ b/src/net/fd_unix.go @@ -82,6 +82,9 @@ func (fd *netFD) connect(ctx context.Context, la, ra syscall.Sockaddr) (rsa sysc defer fd.pfd.SetWriteDeadline(noDeadline) } + // Load the hook function synchronously to prevent a race + // with test code that restores the old value. + testHookCanceledDial := testHookCanceledDial stop := context.AfterFunc(ctx, func() { // Force the runtime's poller to immediately give up // waiting for writability, unblocking waitWrite |
