From d8cb16e3a0d8d1483f89ca106b1e31fc7663b31d Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期日, 29 一月 2023 09:31:15 +0800
Subject: [PATCH] bug fixed query_proc

---
 main.cpp                               |    6 ++++++
 3rdparty/bus_nng/x86_64/libbus_nng.so  |    0 
 3rdparty/bus_nng/aarch64/libbus_nng.so |    0 
 cbhomeclient.cpp                       |   13 ++++++++-----
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/3rdparty/bus_nng/aarch64/libbus_nng.so b/3rdparty/bus_nng/aarch64/libbus_nng.so
index 60c34d7..7f1f19d 100755
--- a/3rdparty/bus_nng/aarch64/libbus_nng.so
+++ b/3rdparty/bus_nng/aarch64/libbus_nng.so
Binary files differ
diff --git a/3rdparty/bus_nng/x86_64/libbus_nng.so b/3rdparty/bus_nng/x86_64/libbus_nng.so
index ceb0f8e..42ea359 100755
--- a/3rdparty/bus_nng/x86_64/libbus_nng.so
+++ b/3rdparty/bus_nng/x86_64/libbus_nng.so
Binary files differ
diff --git a/cbhomeclient.cpp b/cbhomeclient.cpp
index b8b7269..0963c4b 100644
--- a/cbhomeclient.cpp
+++ b/cbhomeclient.cpp
@@ -355,13 +355,16 @@
 
     void* rep = NULL;
     int repl = 0;
-    //auto msg = to_bus<4,5>(ptr(handle), bus_query_procs, pbaddr.data(), pbaddr.size(),
-    //    pbtopic.data(), pbtopic.size(), &rep, &repl, sndto);
+    auto msg = to_bus<4,5>(ptr(handle), bus_query_procs, pbaddr.data(), pbaddr.size(),
+       pbtopic.data(), pbtopic.size(), &rep, &repl, sndto);
 
+    if (msg.empty()) return NULL;
+
+    // bug 宸蹭慨澶嶏紝 鍦� bus_nng 涓�
     // bus_query_procs 鑾峰彇鏁版嵁澶辫触, 鏆傛椂鏀圭敤BHQueryProcs
-    if (!BHQueryProcs(pbaddr.data(), pbaddr.size(), pbtopic.data(), pbtopic.size(), &rep, &repl, sndto)) {
-        return NULL;
-    }
+    // if (!BHQueryProcs(pbaddr.data(), pbaddr.size(), pbtopic.data(), pbtopic.size(), &rep, &repl, sndto)) {
+    //     return NULL;
+    // }
 
     MsgQueryProcReply msgR;
     msgR.ParseFromArray(rep, repl);
diff --git a/main.cpp b/main.cpp
index 1196dfe..bcc2f7c 100644
--- a/main.cpp
+++ b/main.cpp
@@ -62,6 +62,11 @@
         auto msg = bus_client_get_submsg(handle);
         printf("SUB msg topic [%s] data [%s]\n", msg->topic, msg->msg);
         free_submsg(msg);
+
+        size_t count = 0;
+        auto p = bus_client_query_procs(handle, &count);
+        printf("bus_client_query_procs size %lu\n", count);
+        free_query_procs(p, count);
     }
 
     bus_client_free(handle);
@@ -135,6 +140,7 @@
     printf("start RR\n");
     const char* rrtopic = "cbhomeclient_req_rep";
     thread([&]{ req(rrtopic); }).detach();
+
     reply(rrtopic);
 
     return 0;

--
Gitblit v1.8.0