about summary refs log tree commit diff stats
path: root/src/uv_link_source_t.c
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2016-05-26 18:10:04 -0400
committerFedor Indutny <fedor@indutny.com>2016-05-26 18:10:04 -0400
commit48828a62ee235d32c8e53131a55729dea41543ee (patch)
tree4ca3747bd60c1e82ad51055bac935fc38676b267 /src/uv_link_source_t.c
parentb0a811cf3b097753254170dc6fd08e34f8c2b70d (diff)
downloaduv_link_t-48828a62ee235d32c8e53131a55729dea41543ee.tar.gz
uv_link_t: pass source to write/shutdown
Diffstat (limited to 'src/uv_link_source_t.c')
-rw-r--r--src/uv_link_source_t.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/uv_link_source_t.c b/src/uv_link_source_t.c
index d648b78..d3d4c3f 100644
--- a/src/uv_link_source_t.c
+++ b/src/uv_link_source_t.c
@@ -71,22 +71,23 @@ static void uv_link_source_wrap_write_cb(uv_write_t* req, int status) {
 
 
 static int uv_link_source_write(uv_link_t* link,
+                                uv_link_t* source,
                                 const uv_buf_t bufs[],
                                 unsigned int nbufs,
                                 uv_stream_t* send_handle,
                                 uv_link_write_cb cb) {
-  uv_link_source_t* source;
+  uv_link_source_t* s;
   uv_link_source_write_t* req;
 
-  source = container_of(link, uv_link_source_t, link);
+  s= container_of(link, uv_link_source_t, link);
   req = malloc(sizeof(*req));
   if (req == NULL)
     return UV_ENOMEM;
 
-  req->link = link;
+  req->link = source;
   req->write_cb = cb;
 
-  return uv_write2(&req->req, source->stream, bufs, nbufs, send_handle,
+  return uv_write2(&req->req, s->stream, bufs, nbufs, send_handle,
                    uv_link_source_wrap_write_cb);
 }
 
@@ -111,21 +112,22 @@ static void uv_link_source_wrap_shutdown_cb(uv_shutdown_t* req, int status) {
 }
 
 
-static int uv_link_source_shutdown(uv_link_t* link, uv_link_shutdown_cb cb) {
-  uv_link_source_t* source;
+static int uv_link_source_shutdown(uv_link_t* link,
+                                   uv_link_t* source,
+                                   uv_link_shutdown_cb cb) {
+  uv_link_source_t* s;
   uv_link_source_shutdown_t* req;
 
-  source = container_of(link, uv_link_source_t, link);
+  s = container_of(link, uv_link_source_t, link);
 
   req = malloc(sizeof(*req));
   if (req == NULL)
     return UV_ENOMEM;
 
-  req->link = link;
+  req->link = source;
   req->shutdown_cb = cb;
 
-  return uv_shutdown(&req->req, source->stream,
-                     uv_link_source_wrap_shutdown_cb);
+  return uv_shutdown(&req->req, s->stream, uv_link_source_wrap_shutdown_cb);
 }