aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sp/protocol/pair0/pair.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/sp/protocol/pair0/pair.c b/src/sp/protocol/pair0/pair.c
index 254c2810..face19bc 100644
--- a/src/sp/protocol/pair0/pair.c
+++ b/src/sp/protocol/pair0/pair.c
@@ -344,11 +344,6 @@ pair0_sock_send(void *arg, nni_aio *aio)
pair0_sock *s = arg;
nni_msg *m;
size_t len;
- int rv;
-
- if (nni_aio_begin(aio) != 0) {
- return;
- }
m = nni_aio_get_msg(aio);
len = nni_msg_len(m);
@@ -378,8 +373,7 @@ pair0_sock_send(void *arg, nni_aio *aio)
return;
}
- if ((rv = nni_aio_schedule(aio, pair0_cancel, s)) != 0) {
- nni_aio_finish_error(aio, rv);
+ if (!nni_aio_start(aio, pair0_cancel, s)) {
nni_mtx_unlock(&s->mtx);
return;
}
@@ -393,11 +387,6 @@ pair0_sock_recv(void *arg, nni_aio *aio)
pair0_sock *s = arg;
pair0_pipe *p;
nni_msg *m;
- int rv;
-
- if (nni_aio_begin(aio) != 0) {
- return;
- }
nni_mtx_lock(&s->mtx);
p = s->p;
@@ -434,11 +423,11 @@ pair0_sock_recv(void *arg, nni_aio *aio)
return;
}
- if ((rv = nni_aio_schedule(aio, pair0_cancel, s)) != 0) {
- nni_aio_finish_error(aio, rv);
- } else {
- nni_aio_list_append(&s->raq, aio);
+ if (!nni_aio_start(aio, pair0_cancel, s)) {
+ nni_mtx_unlock(&s->mtx);
+ return;
}
+ nni_aio_list_append(&s->raq, aio);
nni_mtx_unlock(&s->mtx);
}