From 27d8bc7cad4a8f68c2da3efbb77f45ec70ae40e6 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期三, 05 一月 2022 14:11:39 +0800 Subject: [PATCH] pb.go MsgQueryProcReply add subLocalTopics and subNetTopics --- src/shm/hashtable.cpp | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/shm/hashtable.cpp b/src/shm/hashtable.cpp index 2cc9e38..ab07ad1 100755 --- a/src/shm/hashtable.cpp +++ b/src/shm/hashtable.cpp @@ -53,7 +53,7 @@ TAILQ_FOREACH(item, my_tailq_head, joint) { - if ((check_mm_valid(item) == true) && (key == item->key)) + if ((check_mm_valid(item) == true) && ((key == item->key) || (code == item->key))) return item->value; break; @@ -316,8 +316,15 @@ static size_t hashcode(int key) { + int val; - return key % MAPSIZE; + if (key < MAPSIZE) { + val = key; + } else { + val = key % MAPSIZE % (MAPSIZE - START_KEY) + START_KEY; + } + + return val; } /** -- Gitblit v1.8.0