| | |
| | | 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."); |
| | | } |
| | | |
| | |
| | | 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 { |