]> Cypherpunks repositories - gostls13.git/commit
net: never return -1 bytes read from netFD.Read
authorDave Cheney <dave@cheney.net>
Sun, 25 Nov 2012 23:59:43 +0000 (10:59 +1100)
committerDave Cheney <dave@cheney.net>
Sun, 25 Nov 2012 23:59:43 +0000 (10:59 +1100)
commit73b3e2301ebbaa4f940006b0869a158156613b4b
treee7e9e8ca79e55aebb15f1586aaffc5e82ddebc39
parentf97bb12bb02b1a5dd0e36032c8079e019fef9d54
net: never return -1 bytes read from netFD.Read

If the a network read would block, and a packet arrived just before the timeout expired, then the number of bytes from the previous (blocking) read, -1, would be returned.

This change restores the previous logic, where n would be unconditionally set to 0 if err != nil, but was skipped due to a change in CL 6851096.

The test for this change is CL 6851061.

R=bradfitz, mikioh.mikioh, dvyukov, rsc
CC=golang-dev
https://golang.org/cl/6852085
src/pkg/net/fd_unix.go