@@ -32,8 +32,14 @@ Data types
3232
3333 Callback called when data was read on a stream.
3434
35- `nread ` is > 0 if there is data available, 0 if libuv is done reading for
36- now, or < 0 on error.
35+ `nread ` is > 0 if there is data available or < 0 on error. When we've
36+ reached EOF, `nread ` will be set to ``UV_EOF ``. When `nread ` < 0,
37+ the `buf ` parameter might not point to a valid buffer; in that case
38+ `buf.len ` and `buf.base ` are both set to 0.
39+
40+ .. note ::
41+ `nread ` might be 0, which does *not * indicate an error or EOF. This
42+ is equivalent to ``EAGAIN `` or ``EWOULDBLOCK `` under ``read(2) ``.
3743
3844 The callee is responsible for stopping closing the stream when an error happens
3945 by calling :c:func: `uv_read_stop ` or :c:func: `uv_close `. Trying to read
125131
126132.. c:function:: int uv_read_start(uv_stream_t* stream, uv_alloc_cb alloc_cb, uv_read_cb read_cb)
127133
128- Read data from an incoming stream. The callback will be made several
129- times until there is no more data to read or :c:func:`uv_read_stop` is called.
130- When we've reached EOF `nread` will be set to ``UV_EOF``.
131-
132- When `nread` < 0, the `buf` parameter might not point to a valid buffer;
133- in that case `buf.len ` and `buf.base ` are both set to 0.
134-
135- .. note ::
136- `nread ` might also be 0, which does *not * indicate an error or EOF, it happens when
137- libuv requested a buffer through the alloc callback but then decided that it didn't
138- need that buffer.
134+ Read data from an incoming stream. The :c:type:`uv_read_cb` callback will
135+ be made several times until there is no more data to read or
136+ :c:func:`uv_read_stop` is called.
139137
140138.. c:function:: int uv_read_stop(uv_stream_t*)
141139
0 commit comments