Skip to content

Commit

Permalink
Fix a bug of recycling bytes in loopWrite
Browse files Browse the repository at this point in the history
  • Loading branch information
panjf2000 committed Sep 24, 2019
1 parent 1ab43e6 commit fe0c167
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion eventloop.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,14 @@ func (l *loop) loopWrite(svr *server, conn *conn) error {

out := conn.outBuf.Bytes()
n, err := unix.Write(conn.fd, out)
ringbuffer.Recycle(out)
if err != nil {
if err == unix.EAGAIN {
return nil
}
return l.loopCloseConn(svr, conn, err)
}
conn.outBuf.Advance(n)
ringbuffer.Recycle(out)

if conn.outBuf.Length() == 0 {
l.poller.ModRead(conn.fd)
Expand Down

0 comments on commit fe0c167

Please sign in to comment.