aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-12-26 16:14:32 -0800
committerGarrett D'Amore <garrett@damore.org>2024-12-26 18:21:22 -0800
commitf915163ead94fa7db84d5e1de60b29c72b5c2466 (patch)
tree8d600e90a4fb91667cbf9ef7f9143ae867b9b257
parentad6ac03e190ccdf0b4ab81c5ac7515a15f29c417 (diff)
downloadnng-f915163ead94fa7db84d5e1de60b29c72b5c2466.tar.gz
nng-f915163ead94fa7db84d5e1de60b29c72b5c2466.tar.bz2
nng-f915163ead94fa7db84d5e1de60b29c72b5c2466.zip
survey protocol conversion to nni_aio_start
-rw-r--r--src/sp/protocol/survey0/respond.c14
-rw-r--r--src/sp/protocol/survey0/survey.c13
2 files changed, 3 insertions, 24 deletions
diff --git a/src/sp/protocol/survey0/respond.c b/src/sp/protocol/survey0/respond.c
index ffa6a2dd..fd1c5601 100644
--- a/src/sp/protocol/survey0/respond.c
+++ b/src/sp/protocol/survey0/respond.c
@@ -146,9 +146,6 @@ resp0_ctx_send(void *arg, nni_aio *aio)
uint32_t pid;
int rv;
- if (nni_aio_begin(aio) != 0) {
- return;
- }
msg = nni_aio_get_msg(aio);
nni_msg_header_clear(msg);
@@ -158,9 +155,8 @@ resp0_ctx_send(void *arg, nni_aio *aio)
}
nni_mtx_lock(&s->mtx);
- if ((rv = nni_aio_schedule(aio, resp0_ctx_cancel_send, ctx)) != 0) {
+ if (!nni_aio_start(aio, resp0_ctx_cancel_send, ctx)) {
nni_mtx_unlock(&s->mtx);
- nni_aio_finish_error(aio, rv);
return;
}
@@ -426,16 +422,10 @@ resp0_ctx_recv(void *arg, nni_aio *aio)
size_t len;
nni_msg *msg;
- if (nni_aio_begin(aio) != 0) {
- return;
- }
nni_mtx_lock(&s->mtx);
if ((p = nni_list_first(&s->recvpipes)) == NULL) {
- int rv;
- rv = nni_aio_schedule(aio, resp0_cancel_recv, ctx);
- if (rv != 0) {
+ if (!nni_aio_start(aio, resp0_cancel_recv, ctx)) {
nni_mtx_unlock(&s->mtx);
- nni_aio_finish_error(aio, rv);
return;
}
// We cannot have two concurrent receive requests on the same
diff --git a/src/sp/protocol/survey0/survey.c b/src/sp/protocol/survey0/survey.c
index b89614bb..66fea985 100644
--- a/src/sp/protocol/survey0/survey.c
+++ b/src/sp/protocol/survey0/survey.c
@@ -154,10 +154,6 @@ surv0_ctx_recv(void *arg, nni_aio *aio)
nni_time now;
nni_duration timeout;
- if (nni_aio_begin(aio) != 0) {
- return;
- }
-
now = nni_clock();
nni_mtx_lock(&sock->mtx);
@@ -175,11 +171,8 @@ surv0_ctx_recv(void *arg, nni_aio *aio)
again:
if (nni_lmq_get(&ctx->recv_lmq, &msg) != 0) {
- int rv;
- if ((rv = nni_aio_schedule(aio, &surv0_ctx_cancel, ctx)) !=
- 0) {
+ if (!nni_aio_start(aio, &surv0_ctx_cancel, ctx)) {
nni_mtx_unlock(&sock->mtx);
- nni_aio_finish_error(aio, rv);
return;
}
nni_list_append(&ctx->recv_queue, aio);
@@ -208,10 +201,6 @@ surv0_ctx_send(void *arg, nni_aio *aio)
nng_duration survey_time;
int rv;
- if (nni_aio_begin(aio) != 0) {
- return;
- }
-
survey_time = nni_atomic_get(&ctx->survey_time);
nni_mtx_lock(&sock->mtx);