aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-12-05 09:52:35 -0800
committerGarrett D'Amore <garrett@damore.org>2020-12-05 09:52:35 -0800
commit0cc9c3a6241948236a14a4a3896ea1147173e53f (patch)
tree991ff486cc788fa70f4ae877fc2a125ca7865f72 /src
parente1dc8358c8515ec456e255585e2952c6c01b62ea (diff)
downloadnng-0cc9c3a6241948236a14a4a3896ea1147173e53f.tar.gz
nng-0cc9c3a6241948236a14a4a3896ea1147173e53f.tar.bz2
nng-0cc9c3a6241948236a14a4a3896ea1147173e53f.zip
fixes #1365 nng_recvmsg returns NNG_ETIMEDOUT rather than NNG_EAGAIN
Diffstat (limited to 'src')
-rw-r--r--src/nng.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/nng.c b/src/nng.c
index 059ec461..10298035 100644
--- a/src/nng.c
+++ b/src/nng.c
@@ -138,7 +138,8 @@ nng_recvmsg(nng_socket s, nng_msg **msgp, int flags)
if ((rv = nng_aio_result(ap)) == 0) {
*msgp = nng_aio_get_msg(ap);
- } else if ((rv == NNG_ETIMEDOUT) && (flags == NNG_FLAG_NONBLOCK)) {
+ } else if ((rv == NNG_ETIMEDOUT) &&
+ ((flags & NNG_FLAG_NONBLOCK) == NNG_FLAG_NONBLOCK)) {
rv = NNG_EAGAIN;
}
nng_aio_free(ap);
@@ -176,7 +177,7 @@ nng_sendmsg(nng_socket s, nng_msg *msg, int flags)
if ((rv = nng_aio_alloc(&ap, NULL, NULL)) != 0) {
return (rv);
}
- if (flags & NNG_FLAG_NONBLOCK) {
+ if ((flags & NNG_FLAG_NONBLOCK) == NNG_FLAG_NONBLOCK) {
nng_aio_set_timeout(ap, NNG_DURATION_ZERO);
} else {
nng_aio_set_timeout(ap, NNG_DURATION_DEFAULT);
@@ -191,7 +192,8 @@ nng_sendmsg(nng_socket s, nng_msg *msg, int flags)
// Possibly massage nonblocking attempt. Note that nonblocking is
// still done asynchronously, and the calling thread loses context.
- if ((rv == NNG_ETIMEDOUT) && (flags == NNG_FLAG_NONBLOCK)) {
+ if ((rv == NNG_ETIMEDOUT) &&
+ ((flags & NNG_FLAG_NONBLOCK) == NNG_FLAG_NONBLOCK)) {
rv = NNG_EAGAIN;
}
@@ -449,8 +451,8 @@ nng_ctx_set_ptr(nng_ctx id, const char *n, void *v)
int
nng_ctx_set_string(nng_ctx id, const char *n, const char *v)
{
- return (ctx_set(
- id, n, v, v == NULL ? 0 : strlen(v) + 1, NNI_TYPE_STRING));
+ return (
+ ctx_set(id, n, v, v == NULL ? 0 : strlen(v) + 1, NNI_TYPE_STRING));
}
int