lib/handshake: pass io.EOF unmodified to the caller for BufferedConn.Read, so it could properly detect the end of stream

This commit is contained in:
Aliaksandr Valialkin 2021-05-27 12:08:06 +03:00
parent 10b2855949
commit c85084b659

View file

@ -47,7 +47,7 @@ func newBufferedConn(c net.Conn, compressionLevel int, isReadCompressed bool) *B
func (bc *BufferedConn) Read(p []byte) (int, error) {
startTime := time.Now()
n, err := bc.br.Read(p)
if err != nil {
if err != nil && err != io.EOF {
err = fmt.Errorf("cannot read data in %.3f seconds: %w", time.Since(startTime).Seconds(), err)
}
return n, err