about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--include/uv_link_t.h33
-rw-r--r--src/uv_link_observer_t.c6
-rw-r--r--test/src/test-uv-link-source-t.c4
3 files changed, 25 insertions, 18 deletions
diff --git a/include/uv_link_t.h b/include/uv_link_t.h
index 2adaac3..25c229a 100644
--- a/include/uv_link_t.h
+++ b/include/uv_link_t.h
@@ -75,6 +75,20 @@ UV_EXTERN void uv_link_propagate_read_cb(uv_link_t* link,
                                          ssize_t nread,
                                          const uv_buf_t* buf);
 
+static int uv_link_propagate_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, void* arg) {
+  return link->methods->write(link, source, bufs, nbufs, send_handle, cb, arg);
+}
+
+static int uv_link_propagate_shutdown(uv_link_t* link,
+                                      uv_link_t* source,
+                                      uv_link_shutdown_cb cb,
+                                      void* arg) {
+  return link->methods->shutdown(link, source, cb, arg);
+}
+
 /* Use this to invoke methods of `link` */
 
 static int uv_link_read_start(uv_link_t* link) {
@@ -85,28 +99,21 @@ static int uv_link_read_stop(uv_link_t* link) {
   return link->methods->read_stop(link);
 }
 
-static int uv_link_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,
-                         void* arg) {
-  return link->methods->write(link, source, bufs, nbufs, send_handle, cb, arg);
+static int uv_link_write(uv_link_t* link, const uv_buf_t bufs[],
+                         unsigned int nbufs, uv_stream_t* send_handle,
+                         uv_link_write_cb cb, void* arg) {
+  return uv_link_propagate_write(link, link, bufs, nbufs, send_handle, cb, arg);
 }
 
-
 static int uv_link_try_write(uv_link_t* link,
                              const uv_buf_t bufs[],
                              unsigned int nbufs) {
   return link->methods->try_write(link, bufs, nbufs);
 }
 
-static int uv_link_shutdown(uv_link_t* link,
-                            uv_link_t* source,
-                            uv_link_shutdown_cb cb,
+static int uv_link_shutdown(uv_link_t* link, uv_link_shutdown_cb cb,
                             void* arg) {
-  return link->methods->shutdown(link, source, cb, arg);
+  return uv_link_propagate_shutdown(link, link, cb, arg);
 }
 
 /* Link Source */
diff --git a/src/uv_link_observer_t.c b/src/uv_link_observer_t.c
index 4e50010..e4deabb 100644
--- a/src/uv_link_observer_t.c
+++ b/src/uv_link_observer_t.c
@@ -33,8 +33,8 @@ static int uv_link_observer_write(uv_link_t* link,
 
   observer = container_of(link, uv_link_observer_t, link);
 
-  return uv_link_write(observer->target, source, bufs, nbufs, send_handle, cb,
-                       arg);
+  return uv_link_propagate_write(observer->target, source, bufs, nbufs,
+                                 send_handle, cb, arg);
 }
 
 
@@ -57,7 +57,7 @@ static int uv_link_observer_shutdown(uv_link_t* link,
 
   observer = container_of(link, uv_link_observer_t, link);
 
-  return uv_link_shutdown(observer->target, source, cb, arg);
+  return uv_link_propagate_shutdown(observer->target, source, cb, arg);
 }
 
 
diff --git a/test/src/test-uv-link-source-t.c b/test/src/test-uv-link-source-t.c
index 99d97d7..ba445a7 100644
--- a/test/src/test-uv-link-source-t.c
+++ b/test/src/test-uv-link-source-t.c
@@ -40,8 +40,8 @@ static void test_writes() {
 
   /* .write() should work */
   buf = uv_buf_init("x", 1);
-  CHECK_EQ(uv_link_write(&source.link, &source.link, &buf, 1, NULL,
-                         source_write_cb, &test_arg),
+  CHECK_EQ(uv_link_write(&source.link, &buf, 1, NULL, source_write_cb,
+                         &test_arg),
            0,
            "source.link.write() should return 0");