]> Cypherpunks.ru repositories - gostls13.git/commit
crypto/tls: retry DialWithTimeout until the listener accepts a connection
authorBryan C. Mills <bcmills@google.com>
Mon, 17 Apr 2023 14:56:09 +0000 (10:56 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 19 Apr 2023 21:40:36 +0000 (21:40 +0000)
commit5c865c78c378548c282b22d96e6d0375079d4417
tree791bee982af85c4e7726bfde1ba85a3c5f29fb64
parent42f89db1538ce9c7e48b04615b0bc7ca098946c1
crypto/tls: retry DialWithTimeout until the listener accepts a connection

The point of DialWithTimeout seems to be to test what happens when the
connection times out during handshake. However, the test wasn't
actually verifying that the connection made it into the handshake at
all. That would not only fail to test the intended behavior, but also
leak the Accept goroutine until arbitrarily later, at which point it
may call t.Error after the test t is already done.

Instead, we now:

- retry the test with a longer timeout if we didn't accept a
  connection, and

- wait for the Accept goroutine to actually complete when the test
  finishes.

Fixes #59646.

Change-Id: Ie56ce3297e2c183c02e67b8f6b26a71e50964558
Reviewed-on: https://go-review.googlesource.com/c/go/+/485115
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Commit-Queue: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/crypto/tls/tls_test.go