summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan Kent <nkent2@cs.rochester.edu>2019-04-23 19:12:07 -0400
committerGarrett D'Amore <garrett@damore.org>2019-04-24 16:39:28 -0700
commit1d61214d9e2c0ba274d1ae7465a4d6baa63cac1c (patch)
tree49a34613bb6fe8d2c866a90ec3ec3c66fccc42b1 /src
parent98655cdaef0f2d1434e12f21793c461a12dbe329 (diff)
downloadnng-1d61214d9e2c0ba274d1ae7465a4d6baa63cac1c.tar.gz
nng-1d61214d9e2c0ba274d1ae7465a4d6baa63cac1c.tar.bz2
nng-1d61214d9e2c0ba274d1ae7465a4d6baa63cac1c.zip
fixes #931 nng_ctx_send can block forever
Diffstat (limited to 'src')
-rw-r--r--src/core/idhash.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/idhash.c b/src/core/idhash.c
index a13a16c8..8f6e9406 100644
--- a/src/core/idhash.c
+++ b/src/core/idhash.c
@@ -98,11 +98,13 @@ static size_t
nni_hash_find_index(nni_idhash *h, uint64_t id)
{
size_t index;
+ size_t start;
if (h->ih_count == 0) {
return ((size_t) -1);
}
index = NNI_IDHASH_INDEX(h, id);
+ start = index;
for (;;) {
// The value of ihe_key is only valid if ihe_val is not NULL.
if ((h->ih_entries[index].ihe_key == id) &&
@@ -113,7 +115,13 @@ nni_hash_find_index(nni_idhash *h, uint64_t id)
return ((size_t) -1);
}
index = NNI_IDHASH_NEXTPROBE(h, index);
+
+ if (index == start) {
+ break;
+ }
}
+
+ return ((size_t) -1);
}
static int