diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-12-26 16:46:35 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-26 18:21:22 -0800 |
| commit | 737fe7ce371f2e308e9e773153cfa0e13ee385d9 (patch) | |
| tree | c1e43bf12a3168f06e7353fa9229cf02a28d2507 /src/sp/protocol/pair1/pair.c | |
| parent | b353de37e99a5a4c5f2e0077a8b68acfa2cf790e (diff) | |
| download | nng-737fe7ce371f2e308e9e773153cfa0e13ee385d9.tar.gz nng-737fe7ce371f2e308e9e773153cfa0e13ee385d9.tar.bz2 nng-737fe7ce371f2e308e9e773153cfa0e13ee385d9.zip | |
pair1: use nni_aio_start
Diffstat (limited to 'src/sp/protocol/pair1/pair.c')
| -rw-r--r-- | src/sp/protocol/pair1/pair.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/sp/protocol/pair1/pair.c b/src/sp/protocol/pair1/pair.c index d7596fb9..b7e40f9d 100644 --- a/src/sp/protocol/pair1/pair.c +++ b/src/sp/protocol/pair1/pair.c @@ -527,16 +527,11 @@ pair1_sock_send(void *arg, nni_aio *aio) pair1_sock *s = arg; nni_msg *m; size_t len; - int rv; m = nni_aio_get_msg(aio); len = nni_msg_len(m); nni_sock_bump_tx(s->sock, len); - if (nni_aio_begin(aio) != 0) { - return; - } - #ifdef NNG_TEST_LIB if (s->inject_header) { goto inject; @@ -589,8 +584,7 @@ inject: return; } - if ((rv = nni_aio_schedule(aio, pair1_cancel, s)) != 0) { - nni_aio_finish_error(aio, rv); + if (!nni_aio_start(aio, pair1_cancel, s)) { nni_mtx_unlock(&s->mtx); return; } @@ -604,11 +598,6 @@ pair1_sock_recv(void *arg, nni_aio *aio) pair1_sock *s = arg; pair1_pipe *p; nni_msg *m; - int rv; - - if (nni_aio_begin(aio) != 0) { - return; - } nni_mtx_lock(&s->mtx); p = s->p; @@ -645,11 +634,11 @@ pair1_sock_recv(void *arg, nni_aio *aio) return; } - if ((rv = nni_aio_schedule(aio, pair1_cancel, s)) != 0) { - nni_aio_finish_error(aio, rv); - } else { - nni_aio_list_append(&s->raq, aio); + if (!nni_aio_start(aio, pair1_cancel, s)) { + nni_mtx_unlock(&s->mtx); + return; } + nni_aio_list_append(&s->raq, aio); nni_mtx_unlock(&s->mtx); } |
