aboutsummaryrefslogtreecommitdiff
path: root/src/nng.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/nng.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/nng.c')
-rw-r--r--src/nng.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nng.c b/src/nng.c
index fb2d0861..49671935 100644
--- a/src/nng.c
+++ b/src/nng.c
@@ -63,13 +63,13 @@ nng_recvmsg(nng_socket *s, nng_msg **msgp, int flags)
nni_time expire;
NNI_INIT_INT();
-
if ((flags == NNG_FLAG_NONBLOCK) || (s->s_rcvtimeo == 0)) {
expire = NNI_TIME_ZERO;
} else if (s->s_rcvtimeo < 0) {
expire = NNI_TIME_NEVER;
} else {
- expire = nni_clock() + s->s_rcvtimeo;
+ expire = nni_clock();
+ expire += s->s_rcvtimeo;
}
return (nni_socket_recvmsg(s, msgp, expire));
@@ -88,7 +88,8 @@ nng_sendmsg(nng_socket *s, nng_msg *msg, int flags)
} else if (s->s_sndtimeo < 0) {
expire = NNI_TIME_NEVER;
} else {
- expire = nni_clock() + s->s_sndtimeo;
+ expire = nni_clock();
+ expire += s->s_sndtimeo;
}
return (nni_socket_sendmsg(s, msg, expire));