From 993c556000a414011626770540678948f16eaa9e Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期三, 02 六月 2021 17:40:50 +0800
Subject: [PATCH] center restart with new shm; set center node ssn.

---
 box/node_center.h |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/box/node_center.h b/box/node_center.h
index 1c79809..a085bdf 100644
--- a/box/node_center.h
+++ b/box/node_center.h
@@ -48,7 +48,6 @@
 class MsgRecords
 {
 	typedef int64_t MsgId;
-	typedef int64_t Offset;
 
 public:
 	void RecordMsg(const MsgI &msg) { msgs_.emplace(msg.id(), msg); }
@@ -122,7 +121,8 @@
 	void RecordMsg(const MsgI &msg);
 	bool SendAllocReply(ShmSocket &socket, const MQInfo &dest, const int64_t reply, const MsgI &msg);
 	bool SendAllocMsg(ShmSocket &socket, const MQInfo &dest, const MsgI &msg);
-	bool ProxyMsg(const MQInfo &dest, BHMsgHead &head, const std::string &body_content, ShmSocket::RecvCB &&cb);
+	bool PassRemoteRequestToLocal(const MQInfo &dest, BHMsgHead &head, const std::string &body_content, ShmSocket::RecvCB &&cb);
+	bool PassRemoteReplyToLocal(const MQInfo &dest, BHMsgHead &head, const std::string &body_content);
 	void OnAlloc(ShmSocket &socket, const int64_t val);
 	void OnFree(ShmSocket &socket, const int64_t val);
 	bool OnCommand(ShmSocket &socket, const int64_t val);
@@ -159,6 +159,14 @@
 	{
 		return HandleMsg<MsgCommonReply, Func>(head, op);
 	}
+	template <class Reply>
+	bool CheckMsg(const BHMsgHead &head, Reply &reply)
+	{
+		bool r = false;
+		auto onOk = [&](Node) { r = true; return MakeReply<Reply>(eSuccess); };
+		reply = HandleMsg<Reply>(head, onOk);
+		return r;
+	}
 
 	MsgCommonReply Unregister(const BHMsgHead &head, MsgUnregister &msg);
 	MsgCommonReply RegisterRPC(const BHMsgHead &head, MsgRegisterRPC &msg);
@@ -184,6 +192,8 @@
 		return node && Valid(*node);
 	}
 	void RemoveNode(Node &node);
+	Node GetNode(const MQId mq);
+
 	std::string id_; // center proc id;
 
 	std::unordered_map<Topic, Clients> service_map_;

--
Gitblit v1.8.0