diff options
| author | Garrett D'Amore <garrett@damore.org> | 2020-01-11 16:25:45 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2020-01-12 09:39:36 -0800 |
| commit | 5521b6e501c478a6113d6db8424bd89fb612763e (patch) | |
| tree | 4f6f9f1697f7166b9a268b9df250e6d9d2808c7e /src/protocol/reqrep0/rep.c | |
| parent | 1b811f68eb0294e947c7b775fd24a239bb44b5b8 (diff) | |
| download | nng-5521b6e501c478a6113d6db8424bd89fb612763e.tar.gz nng-5521b6e501c478a6113d6db8424bd89fb612763e.tar.bz2 nng-5521b6e501c478a6113d6db8424bd89fb612763e.zip | |
Test coverage improvements for REQ/REP.
This also fixes a possible bug if mixing poll file descriptors and
contexts on the same socket. Most folks are unlikely to ever run
into this bug.
At this point the REQ/REP coverage is nearly complete (over 95%).
Diffstat (limited to 'src/protocol/reqrep0/rep.c')
| -rw-r--r-- | src/protocol/reqrep0/rep.c | 10 |
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); |
