From 5521b6e501c478a6113d6db8424bd89fb612763e Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 11 Jan 2020 16:25:45 -0800 Subject: 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%). --- src/protocol/reqrep0/rep.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/protocol/reqrep0/rep.c') 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); -- cgit v1.2.3-70-g09d2