]> Cypherpunks repositories - gostls13.git/commit
crypto/tls: replace net.Pipe in tests with real TCP connections
authorFilippo Valsorda <filippo@golang.org>
Wed, 17 Oct 2018 03:47:55 +0000 (23:47 -0400)
committerFilippo Valsorda <filippo@golang.org>
Fri, 19 Oct 2018 12:43:30 +0000 (12:43 +0000)
commitbe0f3c286b59a486bec798a4aa6e5eba512e49b8
treed39cfa35f1f501815ddd41c4773d6117ea67c072
parent628403fd6b02a8e71926b0cbc7c893121482628a
crypto/tls: replace net.Pipe in tests with real TCP connections

crypto/tls is meant to work over network connections with buffering, not
synchronous connections, as explained in #24198. Tests based on net.Pipe
are unrealistic as reads and writes are matched one to one. Such tests
worked just thanks to the implementation details of the tls.Conn
internal buffering, and would break if for example the flush of the
first flight of the server was not entirely assimilated by the client
rawInput buffer before the client attempted to reply to the ServerHello.

Note that this might run into the Darwin network issues at #25696.

Fixed a few test races that were either hidden or synchronized by the
use of the in-memory net.Pipe.

Also, this gets us slightly more realistic benchmarks, reflecting some
syscall cost of Read and Write operations.

Change-Id: I5a597b3d7a81b8ccc776030cc837133412bf50f8
Reviewed-on: https://go-review.googlesource.com/c/142817
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/crypto/tls/conn_test.go
src/crypto/tls/handshake_client_test.go
src/crypto/tls/handshake_server_test.go
src/crypto/tls/handshake_test.go