From d1f7194a61f349bbd62ab1956001b1a905815ecb Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期二, 23 一月 2024 16:23:48 +0800
Subject: [PATCH] bug fixed
---
src/bh_api.cpp | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/bh_api.cpp b/src/bh_api.cpp
index b768e7e..c450bc2 100644
--- a/src/bh_api.cpp
+++ b/src/bh_api.cpp
@@ -1244,7 +1244,8 @@
char data_buf[MAX_STR_LEN] = { 0x00 };
char buf_temp[MAX_STR_LEN] = { 0x00 };
char *topics_buf = NULL;
-
+ hashtable_t *hashtable = mm_get_hashtable();
+
#if defined(PRO_DE_SERIALIZE)
struct _BHAddress
{
@@ -1301,14 +1302,19 @@
#else
strncpy(buf_temp, (char *)request, (sizeof(buf_temp) - 1) > strlen((char *)request) ? strlen((char *)request) : (sizeof(buf_temp) - 1));
#endif
-
+
str = buf_temp;
val = net_mod_socket_buf_data_get(gNetmod_socket, str);
- if(val > 0) {
-
+ if ((val > 0) && (hashtable_get(hashtable, val) != NULL)) {
+
rv = 0;
} else {
+
+ if ((val > 0) && (hashtable_get(hashtable, val) == NULL)) {
+ net_mod_socket_buf_data_del(gNetmod_socket, str);
+ }
+
rv = net_mod_socket_reg(gNetmod_socket, buf_temp, strlen(buf_temp), &buf, &size, timeout_ms, PROC_QUE_STCS);
if (rv == 0) {
@@ -1420,7 +1426,8 @@
char *errString = NULL;
char buf_temp[MAX_STR_LEN] = { 0x00 };
char *topics_buf = NULL;
-
+ hashtable_t *hashtable = mm_get_hashtable();
+
struct _RequestReply
{
std::string proc_id;
@@ -1487,10 +1494,13 @@
str = buf_temp;
val = net_mod_socket_buf_data_get(gNetmod_socket, str);
- if(val > 0) {
+ if ((val > 0) && (hashtable_get(hashtable, val) != NULL)) {
rv = 0;
-
} else {
+ if ((val > 0) && (hashtable_get(hashtable, val) == NULL)) {
+ net_mod_socket_buf_data_del(gNetmod_socket, str);
+ }
+
rv = net_mod_socket_reg(gNetmod_socket, buf_temp, strlen(buf_temp), &buf, &size, timeout_ms, PROC_QUE_STCS);
if (rv == 0) {
--
Gitblit v1.8.0