Skip to content

Commit

Permalink
fix: fill readv eof
Browse files Browse the repository at this point in the history
  • Loading branch information
Hchenn committed Feb 23, 2022
1 parent 10865ef commit 58bbdba
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions connection_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,23 @@ func (c *connection) fill(need int) (err error) {
for {
n, err = readv(c.fd, c.inputs(c.inputBarrier.bs), c.inputBarrier.ivs)
c.inputAck(n)
if n < pagesize || err != nil {
err = c.eofError(n, err)
if err != nil {
break
}
}
if c.inputBuffer.Len() >= need {
return nil
}
if err == nil {
err = Exception(ErrEOF, "")
return err
}

func (c *connection) eofError(n int, err error) error {
if err == syscall.EINTR {
return nil
}
if n == 0 && err == nil {
return Exception(ErrEOF, "")
}
return err
}

0 comments on commit 58bbdba

Please sign in to comment.