aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/reqrep0/rep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol/reqrep0/rep.c')
-rw-r--r--src/protocol/reqrep0/rep.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/protocol/reqrep0/rep.c b/src/protocol/reqrep0/rep.c
index 3e1a34a9..3cc1802a 100644
--- a/src/protocol/reqrep0/rep.c
+++ b/src/protocol/reqrep0/rep.c
@@ -169,6 +169,11 @@ rep0_ctx_send(void *arg, nni_aio *aio)
// reply for the single request we got.
nni_pollable_clear(&s->writable);
}
+ if ((rv = nni_aio_schedule(aio, rep0_ctx_cancel_send, ctx)) != 0) {
+ nni_mtx_unlock(&s->lk);
+ nni_aio_finish_error(aio, rv);
+ return;
+ }
if (len == 0) {
nni_mtx_unlock(&s->lk);
@@ -202,11 +207,6 @@ rep0_ctx_send(void *arg, nni_aio *aio)
return;
}
- if ((rv = nni_aio_schedule(aio, rep0_ctx_cancel_send, ctx)) != 0) {
- nni_mtx_unlock(&s->lk);
- nni_aio_finish_error(aio, rv);
- return;
- }
ctx->saio = aio;
ctx->spipe = p;
nni_list_append(&p->sendq, ctx);