diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-03-04 02:46:40 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-03-04 02:46:40 -0800 |
| commit | fb6550a242bb1742ec62202a99d0604ee9069795 (patch) | |
| tree | bd235a8ddf6766dc54c3e47b31dbc7a59802d5da /src/transport | |
| parent | c17a1dd3f5333da59355ecc3f8788a0396a8f72d (diff) | |
| download | nng-fb6550a242bb1742ec62202a99d0604ee9069795.tar.gz nng-fb6550a242bb1742ec62202a99d0604ee9069795.tar.bz2 nng-fb6550a242bb1742ec62202a99d0604ee9069795.zip | |
Pipeline protocol now entirely callback driven.
Diffstat (limited to 'src/transport')
| -rw-r--r-- | src/transport/inproc/inproc.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/transport/inproc/inproc.c b/src/transport/inproc/inproc.c index 66f076ea..0cc208d4 100644 --- a/src/transport/inproc/inproc.c +++ b/src/transport/inproc/inproc.c @@ -129,6 +129,38 @@ nni_inproc_pipe_destroy(void *arg) static int +nni_inproc_pipe_aio_send(void *arg, nni_aio *aio) +{ + nni_inproc_pipe *pipe = arg; + nni_msg *msg = aio->a_msg; + char *h; + size_t l; + int rv; + + // We need to move any header data to the body, because the other + // side won't know what to do otherwise. + h = nni_msg_header(msg); + l = nni_msg_header_len(msg); + if ((rv = nni_msg_prepend(msg, h, l)) != 0) { + return (rv); + } + nni_msg_trunc_header(msg, l); + nni_msgq_aio_put(pipe->wq, aio); + return (0); +} + + +static int +nni_inproc_pipe_aio_recv(void *arg, nni_aio *aio) +{ + nni_inproc_pipe *pipe = arg; + + nni_msgq_aio_get(pipe->rq, aio); + return (0); +} + + +static int nni_inproc_pipe_send(void *arg, nni_msg *msg) { nni_inproc_pipe *pipe = arg; @@ -403,6 +435,8 @@ static nni_tran_pipe nni_inproc_pipe_ops = { .pipe_destroy = nni_inproc_pipe_destroy, .pipe_send = nni_inproc_pipe_send, .pipe_recv = nni_inproc_pipe_recv, + .pipe_aio_send = nni_inproc_pipe_aio_send, + .pipe_aio_recv = nni_inproc_pipe_aio_recv, .pipe_close = nni_inproc_pipe_close, .pipe_peer = nni_inproc_pipe_peer, .pipe_getopt = nni_inproc_pipe_getopt, |
