unix: avoid unnecessary read() syscall
This commit is contained in:
parent
0364809fb5
commit
5816f2d21c
@ -563,6 +563,7 @@ static void uv__read(uv_stream_t* stream) {
|
||||
return;
|
||||
} else {
|
||||
/* Successful read */
|
||||
size_t buflen = buf.len;
|
||||
|
||||
if (stream->read_cb) {
|
||||
stream->read_cb(stream, nread, buf);
|
||||
@ -600,6 +601,11 @@ static void uv__read(uv_stream_t* stream) {
|
||||
stream->read2_cb((uv_pipe_t*)stream, nread, buf, UV_UNKNOWN_HANDLE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Return if we didn't fill the buffer, there is no more data to read. */
|
||||
if (nread < buflen) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user