From 16935f4aebffdd1b6580b844391a0aa0f4f3012b Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期一, 22 四月 2024 10:29:12 +0800 Subject: [PATCH] bug fixed --- src/common.h | 30 +++++++++++++++--------------- 1 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/common.h b/src/common.h index cea8c28..78f757d 100644 --- a/src/common.h +++ b/src/common.h @@ -46,18 +46,18 @@ URLHeartBeat, }; -static char* IPC_REGISTER = (char*)"ipc:///tmp/bhnng-center-reg.ipc"; //杩涚▼娉ㄥ唽 -static char* IPC_UNREGISTER = (char*)"ipc:///tmp/bhnng-center-unregister.ipc"; //娉ㄩ攢 -static char* IPC_REGTOPIC = (char*)"ipc:///tmp/bhnng-center-regtopic.ipc"; //娉ㄥ唽涓婚 -static char* IPC_QUERYTOPIC = (char*)"ipc:///tmp/bhnng-center-querytopic.ipc"; //鏌ヨ鎸囧畾鐨勪富棰� -static char* IPC_QUERYPROC = (char*)"ipc:///tmp/bhnng-center-queryproc.ipc"; //鏌ヨ鎵�鏈夋敞鍐岀殑杩涚▼ -static char* IPC_SUBLOCALTOPIC = (char*)"ipc:///tmp/bhnng-center-sublocaltopic.ipc"; //璁㈤槄鏈湴涓婚 -static char* IPC_SUBNETTOPIC = (char*)"ipc:///tmp/bhnng-center-subnettopic.ipc"; //璁㈤槄缃戠粶涓婚 -static char* IPC_HEARTBEAT = (char*)"ipc:///tmp/bhnng-center-hb.ipc"; -static char* IPC_PUB_PROXY = (char*)"ipc:///tmp/bhnng-center-pub-proxy.ipc"; //杩欎釜鏄唬鐞嗕腑蹇冿紝鐢ㄤ簬鎺ユ敹寰呭彂甯冪殑娑堟伅 -static char* IPC_SUB_QUEUE = (char*)"ipc:///tmp/bhnng-center-sub-queue.ipc"; //杩欎釜鏄鎴风浠巆enter璁㈤槄鐨勯�氶亾 +static const char* IPC_REGISTER = (char*)"ipc:///tmp/bhnng-center-reg.ipc"; //杩涚▼娉ㄥ唽 +static const char* IPC_UNREGISTER = (char*)"ipc:///tmp/bhnng-center-unregister.ipc"; //娉ㄩ攢 +static const char* IPC_REGTOPIC = (char*)"ipc:///tmp/bhnng-center-regtopic.ipc"; //娉ㄥ唽涓婚 +static const char* IPC_QUERYTOPIC = (char*)"ipc:///tmp/bhnng-center-querytopic.ipc"; //鏌ヨ鎸囧畾鐨勪富棰� +static const char* IPC_QUERYPROC = (char*)"ipc:///tmp/bhnng-center-queryproc.ipc"; //鏌ヨ鎵�鏈夋敞鍐岀殑杩涚▼ +static const char* IPC_SUBLOCALTOPIC = (char*)"ipc:///tmp/bhnng-center-sublocaltopic.ipc"; //璁㈤槄鏈湴涓婚 +static const char* IPC_SUBNETTOPIC = (char*)"ipc:///tmp/bhnng-center-subnettopic.ipc"; //璁㈤槄缃戠粶涓婚 +static const char* IPC_HEARTBEAT = (char*)"ipc:///tmp/bhnng-center-hb.ipc"; +static const char* IPC_PUB_PROXY = (char*)"ipc:///tmp/bhnng-center-pub-proxy.ipc"; //杩欎釜鏄唬鐞嗕腑蹇冿紝鐢ㄤ簬鎺ユ敹寰呭彂甯冪殑娑堟伅 +static const char* IPC_SUB_QUEUE = (char*)"ipc:///tmp/bhnng-center-sub-queue.ipc"; //杩欎釜鏄鎴风浠巆enter璁㈤槄鐨勯�氶亾 -static const std::unordered_map<int, std::string> map_url{ +static const std::unordered_map<int, const char*> map_url{ {URLReg, IPC_REGISTER}, {URLDeReg, IPC_UNREGISTER}, {URLRegTopic, IPC_REGTOPIC}, @@ -69,12 +69,12 @@ {URLSubQueue, IPC_SUB_QUEUE}, {URLHeartBeat, IPC_HEARTBEAT}, }; -inline std::string get_url(const int type){ +inline const char* get_url(const int type){ auto iter = map_url.find(type); if (iter != map_url.end()){ return iter->second; } - return {}; + return NULL; } template <class... T> struct make_void{typedef void type;}; @@ -133,9 +133,9 @@ struct psmsg{ DISABLE_COPY_AND_ASSIGN(psmsg); psmsg(const std::string& t, std::string&& m) - :topic_(t),data_(std::move(m)){} + :topic_(t),data_(std::move(m)){} psmsg(std::string&& t, std::string&& m) - :topic_(std::move(t)),data_(std::move(m)){} + :topic_(std::move(t)),data_(std::move(m)){} std::string topic_{}; std::string data_{}; }; -- Gitblit v1.8.0