• Adam Langley's avatar
    crypto/tls: buffer handshake messages. · 2a8c81ff
    Adam Langley authored
    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 37c28759 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/23609Reviewed-by: 's avatarAndrew Gerrand <adg@golang.org>
    Run-TryBot: Andrew Gerrand <adg@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    2a8c81ff
handshake_client.go 21.3 KB