Ver código fonte

crypto/tls: don't block on Read of zero bytes

Fixes #7775

LGTM=rsc
R=agl, rsc
CC=golang-codereviews
https://golang.org/cl/88340043
tls13
Brad Fitzpatrick 10 anos atrás
pai
commit
89d6b4b257
1 arquivos alterados com 5 adições e 0 exclusões
  1. +5
    -0
      conn.go

+ 5
- 0
conn.go Ver arquivo

@@ -884,6 +884,11 @@ func (c *Conn) Read(b []byte) (n int, err error) {
if err = c.Handshake(); err != nil {
return
}
if len(b) == 0 {
// Put this after Handshake, in case people were calling
// Read(nil) for the side effect of the Handshake.
return
}

c.in.Lock()
defer c.in.Unlock()


Carregando…
Cancelar
Salvar