Commit 21cf646b authored by Adam Langley's avatar Adam Langley

crypto/tls: fix flakey test.

A test added in b37d2fdcc4d9 didn't work with some values of GOMAXPROCS
because the defer statements were in the wrong order: the Pipe could be
closed before the TLS Client was.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/9187047
parent a65f861b
...@@ -84,7 +84,7 @@ func TestEmptyRecords(t *testing.T) { ...@@ -84,7 +84,7 @@ func TestEmptyRecords(t *testing.T) {
// the first application data from the server. This test ensures that // the first application data from the server. This test ensures that
// the empty record doesn't cause (0, nil) to be returned from // the empty record doesn't cause (0, nil) to be returned from
// Conn.Read. // Conn.Read.
var config = *testConfig config := *testConfig
config.CipherSuites = []uint16{TLS_RSA_WITH_AES_256_CBC_SHA} config.CipherSuites = []uint16{TLS_RSA_WITH_AES_256_CBC_SHA}
c, s := net.Pipe() c, s := net.Pipe()
...@@ -92,8 +92,8 @@ func TestEmptyRecords(t *testing.T) { ...@@ -92,8 +92,8 @@ func TestEmptyRecords(t *testing.T) {
go func() { go func() {
buf := make([]byte, 1024) buf := make([]byte, 1024)
n, err := cli.Read(buf) n, err := cli.Read(buf)
defer cli.Close()
defer c.Close() defer c.Close()
defer cli.Close()
if err != nil { if err != nil {
t.Fatalf("error reading from tls.Client: %s", err) t.Fatalf("error reading from tls.Client: %s", err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment