From 3c7339498c5a47e912f6e6009c197291acd7e1fd Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期四, 03 六月 2021 11:27:39 +0800
Subject: [PATCH] change mq shm name prefix.

---
 box/center_topic_node.cpp |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/box/center_topic_node.cpp b/box/center_topic_node.cpp
index 859aa8b..8228992 100644
--- a/box/center_topic_node.cpp
+++ b/box/center_topic_node.cpp
@@ -29,7 +29,7 @@
 
 namespace
 {
-const std::string &kTopicQueryProc = "@center_query_procs";
+const std::string &kTopicQueryProc = "#center_query_procs";
 
 std::string ToJson(const MsgQueryProcReply &qpr)
 {
@@ -56,7 +56,7 @@
 } // namespace
 
 CenterTopicNode::CenterTopicNode(CenterPtr center, SharedMemory &shm) :
-    pscenter_(center), pnode_(new TopicNode(shm)), run_(false) {}
+    pscenter_(center), pnode_(new TopicNode(shm, 200)), run_(false) {}
 
 CenterTopicNode::~CenterTopicNode() { Stop(); }
 
@@ -77,15 +77,18 @@
 	MsgCommonReply reply;
 
 	ProcInfo info;
-	info.set_proc_id("#center.node");
+	info.set_proc_id("@center.node");
 	info.set_name("center node");
-	if (!pnode_->UniRegister(true, info, reply, timeout)) {
+	Json jinfo;
+	jinfo.put("description", "some center services. Other nodes may use topics to use them.");
+	info.set_public_info(jinfo.dump());
+	if (!pnode_->DoRegister(true, info, reply, timeout)) {
 		throw std::runtime_error("center node register failed.");
 	}
 
 	MsgTopicList topics;
 	topics.add_topic_list(kTopicQueryProc);
-	if (!pnode_->ServerRegisterRPC(topics, reply, timeout)) {
+	if (!pnode_->DoServerRegisterRPC(true, topics, reply, timeout)) {
 		throw std::runtime_error("center node register topics failed.");
 	}
 
@@ -103,7 +106,7 @@
 			*reply.mutable_errmsg() = data.errmsg();
 			reply.set_data(ToJson(data));
 		} else {
-			SetError(*reply.mutable_errmsg(), eInvalidInput, "not supported topic" + request.topic());
+			SetError(*reply.mutable_errmsg(), eInvalidInput, "invalid topic: " + request.topic());
 		}
 		pnode_->ServerSendReply(src_info, reply);
 	};

--
Gitblit v1.8.0