Make it easy to do read(n, cb) #505

isaacs opened this Issue Jul 27, 2012 · 6 comments


None yet

4 participants

isaacs commented Jul 27, 2012

Part of the "make readable streams not terrible" project in Node.

18:24 <@isaacs> piscisaureus: how hard would it be to implement read(n, cb) in
                libuv?  in terms of days/weeks of work, etc.?
18:24 <@isaacs> any rough guess?
18:29 <@piscisaureus> isaacs: *shrug*, not much I suppose
18:29 <@piscisaureus> isaacs: it'd be uv_read_start, basically, but without
                      queuing a new read after reading
18:30 <@piscisaureus> you'd have to ask bnoordhuis for the unix details, but I
                      think we would have to remove the socket fd from the
                      poll set after a read returns. Which is also not that hard.
18:32 <@piscisaureus> uv_read(uv_handle_t*, uv_req_t*, size_t n, uv_alloc_cb
                      on_alloc, uv_read_cb on_read)
18:32 <@piscisaureus> ^— indutny ?
18:32 <@piscisaureus> ^— other libuv users?

@piscisaureus @bnoordhuis

ry commented Jul 27, 2012

uv_err_t uv_read(uv_handle_t*, uv_req_t*, size_t n, uv_alloc_cb on_alloc, uv_read_cb on_read);

LGTM. Obviously this is not going to guarantee a read of n -- just at most n.


Why the uv_err_t return type?

ry commented Jul 28, 2012

dead socket, etc

saghul commented Jul 28, 2012

Isn't the usual to return -1 and use uv_last_error to get the error?

saghul commented Nov 26, 2014

Closing old stalled issues, please reopen at if still needed.

@saghul saghul closed this Nov 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment