From 4e7205cedb5f631d0fbbe72dbf89b5b9205a6260 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 25 Oct 2020 22:23:28 -0700 Subject: fixes #1304 Non-blocking send on rep sockets always fails (#1305) --- src/protocol/reqrep0/rep.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/protocol/reqrep0/rep.c') diff --git a/src/protocol/reqrep0/rep.c b/src/protocol/reqrep0/rep.c index 6f859ee6..86593c26 100644 --- a/src/protocol/reqrep0/rep.c +++ b/src/protocol/reqrep0/rep.c @@ -161,12 +161,6 @@ 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); nni_aio_finish_error(aio, NNG_ESTATE); @@ -199,6 +193,12 @@ 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); -- cgit v1.2.3-70-g09d2