return eagain if nread is 0 per libuv (#100)

Suppress EAGAIN/EWOULDBLOCK equivalents.
This commit is contained in:
bmagistro 2017-09-12 07:39:58 -04:00 committed by Michele Caini
parent 9b4c6373b0
commit ba9b8b459f

View File

@ -141,6 +141,10 @@ class StreamHandle: public Handle<T, U> {
} else if(nread > 0) {
// data available
ref.publish(DataEvent{std::move(data), static_cast<std::size_t>(nread)});
} else if(nread == 0) {
// equivalent to EAGAIN/EWOULDBLOCK
// http://docs.libuv.org/en/v1.x/stream.html
// simply catch this condition and do not publish an event
} else {
// transmission error
ref.publish(ErrorEvent(nread));