Skip to content

Commit

Permalink
consistently return ErrUnexpectedEOF on fallbackSampledConn
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPolo committed Dec 4, 2024
1 parent 2174a1e commit 322cc44
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 322cc44

Please sign in to comment.