From 1c92e4cbc85f9501660444cb76ebb06770da9376 Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期五, 21 五月 2021 15:36:11 +0800 Subject: [PATCH] reserve #xxx proc id for internal use. --- box/center_topic_node.cpp | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/box/center_topic_node.cpp b/box/center_topic_node.cpp index 82b38ca..859aa8b 100644 --- a/box/center_topic_node.cpp +++ b/box/center_topic_node.cpp @@ -79,7 +79,7 @@ ProcInfo info; info.set_proc_id("#center.node"); info.set_name("center node"); - if (!pnode_->Register(info, reply, timeout)) { + if (!pnode_->UniRegister(true, info, reply, timeout)) { throw std::runtime_error("center node register failed."); } @@ -92,7 +92,14 @@ auto onRequest = [this](void *src_info, std::string &client_proc_id, MsgRequestTopic &request) { auto reply = MakeReply<MsgRequestTopicReply>(eSuccess); if (request.topic() == kTopicQueryProc) { - auto data = (*pscenter_)->QueryProc(request.data()); + std::string id; + if (!request.data().empty()) { + Json json; + if (json.parse(request.data())) { + id = json.get("proc_id", ""); + } + } + auto data = (*pscenter_)->QueryProc(id); *reply.mutable_errmsg() = data.errmsg(); reply.set_data(ToJson(data)); } else { -- Gitblit v1.8.0