From 123e1439a284716c651eca037b95ba997e6c30db Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 27 Dec 2016 20:46:32 -0800 Subject: Send and receive now work. This fixes a few core issues, and improves readability for the message queue code as well. inproc delivery of messages works now. --- src/core/endpt.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/core/endpt.c') diff --git a/src/core/endpt.c b/src/core/endpt.c index 24d92206..bb3ba268 100644 --- a/src/core/endpt.c +++ b/src/core/endpt.c @@ -197,7 +197,10 @@ nni_dialer(void *arg) nni_mutex_enter(&ep->ep_mx); while (!ep->ep_close) { // We need a different condvar... - nni_cond_waituntil(&ep->ep_cv, cooldown); + rv = nni_cond_waituntil(&ep->ep_cv, cooldown); + if (rv == NNG_ETIMEDOUT) { + break; + } } nni_mutex_exit(&ep->ep_mx); } @@ -312,8 +315,11 @@ nni_listener(void *arg) cooldown = 10000; cooldown += nni_clock(); while (!ep->ep_close) { - nni_cond_waituntil(&ep->ep_cv, + rv = nni_cond_waituntil(&ep->ep_cv, cooldown); + if (rv == NNG_ETIMEDOUT) { + break; + } } } } @@ -338,9 +344,13 @@ nni_listener(void *arg) // time for the system to reclaim resources. cooldown = 100000; // 100ms } + cooldown += nni_clock(); nni_mutex_enter(&ep->ep_mx); - if (!ep->ep_close) { - nni_cond_waituntil(&ep->ep_cv, cooldown); + while (!ep->ep_close) { + rv = nni_cond_waituntil(&ep->ep_cv, cooldown); + if (rv == NNG_ETIMEDOUT) { + break; + } } nni_mutex_exit(&ep->ep_mx); } -- cgit v1.2.3-70-g09d2