diff options
author | Fedor Indutny <fedor@indutny.com> | 2016-05-27 12:16:05 -0400 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2016-05-27 12:16:05 -0400 |
commit | d7de504f56f35ad7b14434cbd972687c7a3d88f1 (patch) | |
tree | ab952daef0c7e9f2728792c806fd6c42b8f341ed /include/uv_link_t.h | |
parent | 28facffd6105b2da1699922bf2cbc545aa1cceae (diff) | |
download | uv_link_t-d7de504f56f35ad7b14434cbd972687c7a3d88f1.tar.gz |
api: simplify
Diffstat (limited to 'include/uv_link_t.h')
-rw-r--r-- | include/uv_link_t.h | 33 |
1 files changed, 20 insertions, 13 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 */ |