lichao
2021-06-01 365c864a587365fe443b11cc0cd7cfc8f8f8eb81
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)
{
@@ -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);
   };