Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

uv_listen uv_read API refactor #57

Closed
ry opened this issue Jun 14, 2011 · 1 comment
Closed

uv_listen uv_read API refactor #57

ry opened this issue Jun 14, 2011 · 1 comment
Labels

Comments

@ry
Copy link
Contributor

ry commented Jun 14, 2011

I would like to change the API of uv_listen and uv_read to be a similar interface:

/* uv_accept() is used in conjunction with uv_listen() to accept incoming
 * TCP connections. After receiving a uv_connection_cb call uv_accept() to
 * accept the connection. Before calling uv_accept use uv_tcp_init() must be
 * called on the client. Non-zero return value indicates an error.
 *
 * When the uv_connection_cb is called it is guaranteed that uv_accept()
 * will complete successfully the first time. If you attempt to use it more
 * than once, it may fail. It is suggested to only call uv_accept once per
 * uv_connection_cb call.
 */
int uv_listen_start(uv_tcp_t* handle, int backlog, uv_connection_cb cb);
int uv_listen_stop(uv_tcp_t* handle);
int uv_accept(uv_tcp_t* server, uv_tcp_t* client);


/* Read data from an incoming stream. uv_read_start() allows the TCP handle
 * to be notified of readablity via the read_cb. When the handle is readable
 * uv_read() can be used to read the data
 *
 * Each time the uv_read_cb is called the user should call uv_read with a
 * pointer to a uv_buf_t. For best results the user should provide a
 * uv_buf_t with 64kb of space. The supplied buffer will be filled with TCP
 * data.
 *
 * uv_read() will return zero when EOF is reached; -1 when an error occured.
 */
int uv_read_start(uv_tcp_t*, uv_read_cb read_cb);
int uv_read_stop(uv_tcp_t*);
ssize_t uv_read(uv_tcp_t*, uv_buf_t* buf);
@ry
Copy link
Contributor Author

ry commented Jun 14, 2011

nevermind

@ry ry closed this as completed Jun 14, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant