]> Cypherpunks repositories - gostls13.git/commit
net: create unix sockets in unique directories
authorBryan C. Mills <bcmills@google.com>
Thu, 9 Dec 2021 16:55:20 +0000 (11:55 -0500)
committerBryan Mills <bcmills@google.com>
Mon, 13 Dec 2021 16:42:31 +0000 (16:42 +0000)
commit4b3d8d1a390a51ea6a1b3f66ef9d56ef7203bbe7
treefaa6991261baf219df06070126015395847bb1aa
parentb55cbbb9e76969d67fbc6e264a584ad18c2f95fa
net: create unix sockets in unique directories

This change applies the same transformation as in CL 366774,
but to the net package.

testUnixAddr was using os.CreateTemp to obtain a unique socket path,
but then calling os.Remove on that path immediately. Since the
existence of the file is what guarantees its uniqueness, that could
occasionally result in testUnixAddr returning the same path for two
calls, causing the tests using those paths to fail — especially if
they are the same test or are run in parallel.

Instead, we now create a unique, short temp directory for each call,
and use a path within that directory for the socket address.

For #34611

Change-Id: I8e13b606abce2479a0305f7aeecf5d54c449a032
Reviewed-on: https://go-review.googlesource.com/c/go/+/370694
Trust: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/net/mockserver_test.go
src/net/packetconn_test.go
src/net/protoconn_test.go
src/net/server_test.go
src/net/splice_test.go
src/net/unixsock_test.go
src/net/unixsock_windows_test.go