Skip to content

Instantly share code, notes, and snippets.

@ry
Created September 23, 2011 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ry/1238738 to your computer and use it in GitHub Desktop.
Save ry/1238738 to your computer and use it in GitHub Desktop.
commit 403a4b400032579db6f8552bc3bf415e1ed4b660
Author: Ryan Dahl <ry@tinyclouds.org>
Date: Fri Sep 23 11:58:12 2011 -0700
wip
diff --git a/include/uv.h b/include/uv.h
index b8bdc09..948996a 100644
--- a/include/uv.h
+++ b/include/uv.h
@@ -121,6 +121,13 @@ int64_t uv_now(uv_loop_t*);
*/
typedef uv_buf_t (*uv_alloc_cb)(uv_handle_t* handle, size_t suggested_size);
typedef void (*uv_read_cb)(uv_stream_t* stream, ssize_t nread, uv_buf_t buf);
+/*
+ * Just like the uv_read_cb except that if the pending parameter is true
+ * then you can use uv_accept() to pull the new parameter into the process.
+ * If no handle is pending then pending will be UV_UNKNOWN_HANDLE.
+ */
+typedef void (*uv_read2_cb)(uv_pipe_t* pipe, ssize_t nread, uv_buf_t buf,
+ uv_handle_type pending);
typedef void (*uv_write_cb)(uv_write_t* req, int status);
typedef void (*uv_connect_cb)(uv_connect_t* req, int status);
typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status);
@@ -338,8 +345,8 @@ uv_buf_t uv_buf_init(char* base, size_t len);
*
* uv_stream is an abstract class.
*
- * uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t, uv_tty_t
- * and soon uv_file_t.
+ * uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t, uv_tty_t, and
+ * soon uv_file_t.
*/
struct uv_stream_s {
UV_HANDLE_FIELDS
@@ -375,6 +382,11 @@ int uv_read_start(uv_stream_t*, uv_alloc_cb alloc_cb, uv_read_cb read_cb);
int uv_read_stop(uv_stream_t*);
+/*
+ * Extended read methods for receiving handles over a pipe.
+ */
+int uv_read2_start(uv_stream_t*, uv_alloc_cb alloc_cb, uv_read2_cb read_cb);
+
typedef enum {
UV_STDIN = 0,
UV_STDOUT,
@@ -404,6 +416,9 @@ uv_stream_t* uv_std_handle(uv_loop_t*, uv_std_type type);
int uv_write(uv_write_t* req, uv_stream_t* handle, uv_buf_t bufs[], int bufcnt,
uv_write_cb cb);
+int uv_write2(uv_write_t* req, uv_stream_t* handle, uv_buf_t bufs[], int bufcnt,
+ uv_stream_t* send_handle, uv_write_cb cb);
+
/* uv_write_t is a subclass of uv_req_t */
struct uv_write_s {
UV_REQ_FIELDS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment