From 95c92335fb793fec124a2de716290994dcaa3fd7 Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期五, 23 四月 2021 17:09:33 +0800
Subject: [PATCH] update bhome_msg_api.pb.go

---
 box/center.cpp |   20 +++++---------------
 1 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/box/center.cpp b/box/center.cpp
index a95e82d..3059e90 100644
--- a/box/center.cpp
+++ b/box/center.cpp
@@ -27,7 +27,6 @@
 
 using namespace bhome_shm;
 using namespace bhome_msg;
-using namespace bhome::msg;
 typedef BHCenter::MsgHandler Handler;
 
 namespace
@@ -39,7 +38,7 @@
 public:
 	typedef std::string ProcId;
 	typedef std::string Address;
-	typedef bhome::msg::ProcInfo ProcInfo;
+	typedef bhome_msg::ProcInfo ProcInfo;
 	typedef std::function<void(Address const &)> Cleaner;
 
 private:
@@ -97,12 +96,9 @@
 	NodeCenter(const std::string &id, const Cleaner &cleaner, const steady_clock::duration offline_time, const steady_clock::duration kill_time) :
 	    NodeCenter(id, cleaner, duration_cast<seconds>(offline_time).count(), duration_cast<seconds>(kill_time).count()) {}
 
-	const std::string &id() const
-	{
-		return id_;
-	} // no need to lock.
+	// center name, no relative to shm.
+	const std::string &id() const { return id_; }
 
-	//TODO maybe just return serialized string.
 	MsgCommonReply Register(const BHMsgHead &head, MsgRegister &msg)
 	{
 		if (msg.proc().proc_id() != head.proc_id()) {
@@ -399,7 +395,7 @@
 
 Handler Combine(const Handler &h1, const Handler &h2)
 {
-	return [h1, h2](ShmSocket &socket, bhome_msg::MsgI &msg, bhome::msg::BHMsgHead &head) {
+	return [h1, h2](ShmSocket &socket, bhome_msg::MsgI &msg, bhome_msg::BHMsgHead &head) {
 		return h1(socket, msg, head) || h2(socket, msg, head);
 	};
 }
@@ -494,12 +490,6 @@
 
 } // namespace
 
-SharedMemory &BHomeShm()
-{
-	static SharedMemory shm("bhome_default_shm_v0", 1024 * 1024 * 512);
-	return shm;
-}
-
 BHCenter::CenterRecords &BHCenter::Centers()
 {
 	static CenterRecords rec;
@@ -523,7 +513,7 @@
 		printf("remove mq : %s\n", r ? "ok" : "failed");
 	};
 
-	AddCenter("#center", gc);
+	AddCenter("#bhome_center", gc);
 
 	for (auto &kv : Centers()) {
 		auto &info = kv.second;

--
Gitblit v1.8.0