Commit 3656c2db authored by Adam Langley's avatar Adam Langley

crypto/tls: split connErr to avoid read/write races.

Currently a write error will cause future reads to return that same error.
However, there may have been extra information from a peer pending on
the read direction that is now unavailable.

This change splits the single connErr into errors for the read, write and
handshake. (Splitting off the handshake error is needed because both read
and write paths check the handshake error.)

Fixes #7414.

LGTM=bradfitz, r
R=golang-codereviews, r, bradfitz
CC=golang-codereviews
https://golang.org/cl/69090044
parent 8b1b1e15
This diff is collapsed.
...@@ -501,7 +501,7 @@ func (hs *clientHandshakeState) readFinished() error { ...@@ -501,7 +501,7 @@ func (hs *clientHandshakeState) readFinished() error {
c := hs.c c := hs.c
c.readRecord(recordTypeChangeCipherSpec) c.readRecord(recordTypeChangeCipherSpec)
if err := c.error(); err != nil { if err := c.in.error(); err != nil {
return err return err
} }
......
...@@ -470,7 +470,7 @@ func (hs *serverHandshakeState) readFinished() error { ...@@ -470,7 +470,7 @@ func (hs *serverHandshakeState) readFinished() error {
c := hs.c c := hs.c
c.readRecord(recordTypeChangeCipherSpec) c.readRecord(recordTypeChangeCipherSpec)
if err := c.error(); err != nil { if err := c.in.error(); err != nil {
return err return 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