aboutsummaryrefslogtreecommitdiff
path: root/src/sp/transport
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-12-26 12:18:54 -0800
committerGarrett D'Amore <garrett@damore.org>2024-12-26 12:53:46 -0800
commit8027aebffe30fefbd320ac1c14866bfe85c1e915 (patch)
tree3b56544551ddd55e770634c287aac6e70bd93ced /src/sp/transport
parent2c4324c2b7a3dd5583b3b2c499575cf1c8e52e0c (diff)
downloadnng-8027aebffe30fefbd320ac1c14866bfe85c1e915.tar.gz
nng-8027aebffe30fefbd320ac1c14866bfe85c1e915.tar.bz2
nng-8027aebffe30fefbd320ac1c14866bfe85c1e915.zip
inproc: use nni_aio_start
Diffstat (limited to 'src/sp/transport')
-rw-r--r--src/sp/transport/inproc/inproc.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/sp/transport/inproc/inproc.c b/src/sp/transport/inproc/inproc.c
index fcf75566..e87e9c4b 100644
--- a/src/sp/transport/inproc/inproc.c
+++ b/src/sp/transport/inproc/inproc.c
@@ -194,16 +194,10 @@ inproc_pipe_send(void *arg, nni_aio *aio)
inproc_pipe *pipe = arg;
inproc_queue *queue = pipe->send_queue;
- if (nni_aio_begin(aio) != 0) {
- // No way to give the message back to the protocol, so
- // we just discard it silently to prevent it from leaking.
- nni_msg_free(nni_aio_get_msg(aio));
- nni_aio_set_msg(aio, NULL);
- return;
- }
+ nni_aio_reset(aio);
nni_mtx_lock(&queue->lock);
- if (!nni_aio_defer(aio, inproc_queue_cancel, queue)) {
+ if (!nni_aio_start(aio, inproc_queue_cancel, queue)) {
nni_mtx_unlock(&queue->lock);
return;
}
@@ -218,12 +212,10 @@ inproc_pipe_recv(void *arg, nni_aio *aio)
inproc_pipe *pipe = arg;
inproc_queue *queue = pipe->recv_queue;
- if (nni_aio_begin(aio) != 0) {
- return;
- }
+ nni_aio_reset(aio);
nni_mtx_lock(&queue->lock);
- if (!nni_aio_defer(aio, inproc_queue_cancel, queue)) {
+ if (!nni_aio_start(aio, inproc_queue_cancel, queue)) {
nni_mtx_unlock(&queue->lock);
return;
}
@@ -460,9 +452,7 @@ inproc_ep_connect(void *arg, nni_aio *aio)
inproc_ep *ep = arg;
inproc_ep *server;
- if (nni_aio_begin(aio) != 0) {
- return;
- }
+ nni_aio_reset(aio);
nni_mtx_lock(&nni_inproc.mx);
@@ -481,7 +471,7 @@ inproc_ep_connect(void *arg, nni_aio *aio)
// We don't have to worry about the case where a zero timeout
// on connect was specified, as there is no option to specify
// that in the upper API.
- if (!nni_aio_defer(aio, inproc_ep_cancel, ep)) {
+ if (!nni_aio_start(aio, inproc_ep_cancel, ep)) {
nni_mtx_unlock(&nni_inproc.mx);
return;
}
@@ -518,15 +508,13 @@ inproc_ep_accept(void *arg, nni_aio *aio)
{
inproc_ep *ep = arg;
- if (nni_aio_begin(aio) != 0) {
- return;
- }
+ nni_aio_reset(aio);
nni_mtx_lock(&nni_inproc.mx);
// We need not worry about the case where a non-blocking
// accept was tried -- there is no API to do such a thing.
- if (!nni_aio_defer(aio, inproc_ep_cancel, ep)) {
+ if (!nni_aio_start(aio, inproc_ep_cancel, ep)) {
nni_mtx_unlock(&nni_inproc.mx);
return;
}