]> Cypherpunks repositories - gostls13.git/commit
crypto/tls: buffer handshake messages.
authorAdam Langley <agl@golang.org>
Wed, 1 Jun 2016 21:41:09 +0000 (14:41 -0700)
committerAndrew Gerrand <adg@golang.org>
Wed, 1 Jun 2016 23:26:04 +0000 (23:26 +0000)
commit2a8c81ffaadc69add6ff85b241691adb7f9f24ff
treef7de85f72e39e42ceb26e947739871b3e089201f
parentf6c0241999bffe0fe52e8b7f5bbcc8f9e02edbdf
crypto/tls: buffer handshake messages.

This change causes TLS handshake messages to be buffered and written in
a single Write to the underlying net.Conn.

There are two reasons to want to do this:

Firstly, it's slightly preferable to do this in order to save sending
several, small packets over the network where a single one will do.

Secondly, since 37c28759ca46cf381a466e32168a793165d9c9e9 errors from
Write have been returned from a handshake. This means that, if a peer
closes the connection during a handshake, a “broken pipe” error may
result from tls.Conn.Handshake(). This can mask any, more detailed,
fatal alerts that the peer may have sent because a read will never
happen.

Buffering handshake messages means that the peer will not receive, and
possibly reject, any of a flow while it's still being written.

Fixes #15709

Change-Id: I38dcff1abecc06e52b2de647ea98713ce0fb9a21
Reviewed-on: https://go-review.googlesource.com/23609
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/crypto/tls/conn.go
src/crypto/tls/handshake_client.go
src/crypto/tls/handshake_client_test.go
src/crypto/tls/handshake_server.go