From d1a9c84a6b375cb25a8b7475957130e364b41753 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 2 Jul 2018 22:36:08 -0700 Subject: fixes #572 Several locking errors found fixes #573 atomic flags could help This introduces a new atomic flag, and reduces some of the global locking. The lock refactoring work is not yet complete, but this is a positive step forward, and should help with certain things. While here we also fixed a compile warning due to incorrect types. --- src/protocol/reqrep0/rep.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/protocol/reqrep0/rep.c') diff --git a/src/protocol/reqrep0/rep.c b/src/protocol/reqrep0/rep.c index 1f4f0b33..f725cadb 100644 --- a/src/protocol/reqrep0/rep.c +++ b/src/protocol/reqrep0/rep.c @@ -413,15 +413,14 @@ rep0_pipe_send_cb(void *arg) nni_msg * msg; size_t len; - nni_mtx_lock(&s->lk); - p->busy = false; if (nni_aio_result(p->aio_send) != 0) { nni_msg_free(nni_aio_get_msg(p->aio_send)); nni_aio_set_msg(p->aio_send, NULL); nni_pipe_stop(p->pipe); - nni_mtx_unlock(&s->lk); return; } + nni_mtx_lock(&s->lk); + p->busy = false; if ((ctx = nni_list_first(&p->sendq)) == NULL) { // Nothing else to send. if (p->id == s->ctx->pipe_id) { -- cgit v1.2.3-70-g09d2