diff --git a/p2p/transport/tcpreuse/internal/sampledconn/sampledconn_common.go b/p2p/transport/tcpreuse/internal/sampledconn/sampledconn_common.go index 7324b45849..78bac2421c 100644 --- a/p2p/transport/tcpreuse/internal/sampledconn/sampledconn_common.go +++ b/p2p/transport/tcpreuse/internal/sampledconn/sampledconn_common.go @@ -71,8 +71,11 @@ type ManetTCPConnInterface interface { func newFallbackSampledConn(conn ManetTCPConnInterface) (PeekedBytes, *fallbackPeekingConn, error) { s := &fallbackPeekingConn{ManetTCPConnInterface: conn} - _, err := io.ReadFull(conn, s.peekedBytes[:]) + n, err := io.ReadFull(conn, s.peekedBytes[:]) if err != nil { + if n == 0 && err == io.EOF { + err = io.ErrUnexpectedEOF + } return s.peekedBytes, nil, err } return s.peekedBytes, s, nil