Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
isaacs opened this Issue · 6 comments

4 participants

@isaacs

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
ry commented

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.

@bnoordhuis

Why the uv_err_t return type?

@ry
ry commented

dead socket, etc

@saghul
Collaborator

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

@saghul
Collaborator

Closing old stalled issues, please reopen at https://github.com/libuv/libuv if still needed.

@saghul saghul closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.