From f552a0ea788225d8fe80942d6e8bd6500f788393 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期一, 11 四月 2022 09:08:20 +0800
Subject: [PATCH] add log

---
 src/interface_bus_api.cpp |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/interface_bus_api.cpp b/src/interface_bus_api.cpp
index 65dd669..638f31a 100644
--- a/src/interface_bus_api.cpp
+++ b/src/interface_bus_api.cpp
@@ -108,8 +108,12 @@
     }
 
     string msg(mtl2.SerializeAsString());
-
-    return simple_request(get_url(URLRegTopic), msg.data(), msg.size(), reply, reply_len, timeout_ms);
+    const auto& url = get_url(URLRegTopic);
+    if (url.empty()) {
+        set_last_error("bus_register_topics url empty");
+        return false;
+    }
+    return simple_request(url, msg.data(), msg.size(), reply, reply_len, timeout_ms);
 }
 
 int bus_query_topic_address(void* handle, const void *remote,
@@ -132,6 +136,10 @@
     }
 
     auto url(get_url(URLQueryTopic));
+    if (url.empty()) {
+        set_last_error("bus_query_topic_address url empty");
+        return false;
+    }
 
     // if (remote && remote_len > 0){
     //     BHAddress addr;
@@ -166,7 +174,10 @@
     }
 
     auto url(get_url(URLQueryProcs));
-
+    if (url.empty()) {
+        set_last_error("bus_query_procs url empty");
+        return false;
+    }
     // if (remote && remote_len > 0){
     //     BHAddress addr;
     //     if (addr.ParseFromArray(remote, remote_len)){
@@ -344,7 +355,10 @@
             }
         }
     }
-
+    if (url.empty()) {
+        set_last_error("bus_request url empty");
+        return false;
+    }
     int rc = request2(url, request, request_len, reply, reply_len, timeout_ms);
     if (rc < 0) return false;
     copy_memory(proc_id, proc_id_len, procid.data(), procid.size());

--
Gitblit v1.8.0