Callbacks for libuv stream reads do not signal zero-length reads as a
failure signal but rather as EAGAIN/EWOULDBLOCK. This can trigger an
assertion when a zero-length read is pushed onto a PROXYv2 endpoint that
has not yet processed the headers as it expects a non-NULL region of
positive length.
goto free;
}
- if (nread < 0) {
+ if (nread == 0) {
+ /* EAGAIN/EWOULDBLOCK: no data yet, not an error on libuv. */
+ goto free;
+ } else if (nread < 0) {
if (nread != UV_EOF) {
isc__nm_incstats(sock, STATID_RECVFAIL);
}
}
free:
- if (nread < 0) {
+ if (nread <= 0) {
/*
* The buffer may be a null buffer on error.
*/