aboutsummaryrefslogtreecommitdiff
path: root/src/core/endpt.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-27 20:46:32 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-27 20:46:32 -0800
commit123e1439a284716c651eca037b95ba997e6c30db (patch)
treefc44cecd5fcb0e0f01532ac8e1ddf4d9499659f6 /src/core/endpt.c
parent9c8576a3f0357e611c0892dfe1d0d4c2afe73bf2 (diff)
downloadnng-123e1439a284716c651eca037b95ba997e6c30db.tar.gz
nng-123e1439a284716c651eca037b95ba997e6c30db.tar.bz2
nng-123e1439a284716c651eca037b95ba997e6c30db.zip
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.
Diffstat (limited to 'src/core/endpt.c')
-rw-r--r--src/core/endpt.c18
1 files changed, 14 insertions, 4 deletions
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);
}