summaryrefslogtreecommitdiff
path: root/src/protocol/reqrep0/rep.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-10-25 22:23:28 -0700
committerGitHub <noreply@github.com>2020-10-25 22:23:28 -0700
commit4e7205cedb5f631d0fbbe72dbf89b5b9205a6260 (patch)
treeee0d0a5009d31247520fafa1f3e6334d60a664c2 /src/protocol/reqrep0/rep.c
parent206de0ad6f338c7e375885443836fbb44853550b (diff)
downloadnng-4e7205cedb5f631d0fbbe72dbf89b5b9205a6260.tar.gz
nng-4e7205cedb5f631d0fbbe72dbf89b5b9205a6260.tar.bz2
nng-4e7205cedb5f631d0fbbe72dbf89b5b9205a6260.zip
fixes #1304 Non-blocking send on rep sockets always fails (#1305)
Diffstat (limited to 'src/protocol/reqrep0/rep.c')
-rw-r--r--src/protocol/reqrep0/rep.c12
1 files changed, 6 insertions, 6 deletions
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);