diff options
| author | Garrett D'Amore <garrett@damore.org> | 2020-01-01 23:00:35 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2020-01-01 23:10:47 -0800 |
| commit | 835821497a9bbd0d65c20714279c6a2c102016c1 (patch) | |
| tree | b5c6e0ea177a5d120c0662929ab990a91c0ba737 /src/protocol/reqrep0/rep.c | |
| parent | 11985f8c59cccc0364bde7dd314e246ea53cff90 (diff) | |
| download | nng-835821497a9bbd0d65c20714279c6a2c102016c1.tar.gz nng-835821497a9bbd0d65c20714279c6a2c102016c1.tar.bz2 nng-835821497a9bbd0d65c20714279c6a2c102016c1.zip | |
fixes #1088 REP protocol does not signal SENDFD properly
We've also added some TEST_NNG_SEND_STR and TEST_NNG_RECV_STR to
help with convenience when writing test code.
Diffstat (limited to 'src/protocol/reqrep0/rep.c')
| -rw-r--r-- | src/protocol/reqrep0/rep.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/protocol/reqrep0/rep.c b/src/protocol/reqrep0/rep.c index 2d00b65f..f8c15fa6 100644 --- a/src/protocol/reqrep0/rep.c +++ b/src/protocol/reqrep0/rep.c @@ -1,5 +1,5 @@ // -// Copyright 2019 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -502,6 +502,9 @@ rep0_ctx_recv(void *arg, nni_aio *aio) nni_pollable_clear(s->recvable); } nni_pipe_recv(p->pipe, p->aio_recv); + if ((ctx == s->ctx) && !p->busy) { + nni_pollable_raise(s->sendable); + } len = nni_msg_header_len(msg); memcpy(ctx->btrace, nni_msg_header(msg), len); @@ -583,6 +586,9 @@ rep0_pipe_recv_cb(void *arg) aio = ctx->raio; ctx->raio = NULL; nni_aio_set_msg(p->aio_recv, NULL); + if ((ctx == s->ctx) && !p->busy) { + nni_pollable_raise(s->sendable); + } // schedule another receive nni_pipe_recv(p->pipe, p->aio_recv); @@ -592,13 +598,6 @@ rep0_pipe_recv_cb(void *arg) nni_msg_header_clear(msg); ctx->pipe_id = p->id; - // If we got a request on a pipe that wasn't busy, we should - // mark it sendable. (The sendable flag is not set when there - // is no request needing a reply.) - if ((ctx == s->ctx) && (!p->busy)) { - nni_pollable_raise(s->sendable); - } - nni_mtx_unlock(&s->lk); nni_aio_set_msg(aio, msg); |
