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/center.cpp |   18 +++++-------------
 1 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/box/center.cpp b/box/center.cpp
index 0fdfa33..020d1bf 100644
--- a/box/center.cpp
+++ b/box/center.cpp
@@ -45,18 +45,6 @@
 	}
 }
 
-Handler Combine(const Handler &h1, const Handler &h2)
-{
-	return [h1, h2](ShmSocket &socket, bhome_msg::MsgI &msg, bhome_msg::BHMsgHead &head) {
-		return h1(socket, msg, head) || h2(socket, msg, head);
-	};
-}
-template <class... H>
-Handler Combine(const Handler &h0, const Handler &h1, const Handler &h2, const H &...rest)
-{
-	return Combine(Combine(h0, h1), h2, rest...);
-}
-
 #define CASE_ON_MSG_TYPE(MsgTag)                                                         \
 	case kMsgType##MsgTag:                                                               \
 		Dispatch<Msg##MsgTag>(                                                           \
@@ -116,7 +104,11 @@
 							center->PassRemoteReplyToLocal(dest, head, std::move(body_content));
 						}
 					};
-					if (!tcp_proxy.Request(head.dest().ip(), head.dest().port(), msg.content(), onResult)) {
+					uint16_t port = head.dest().port();
+					if (port == 0) {
+						port = kBHCenterPort;
+					}
+					if (!tcp_proxy.Request(head.dest().ip(), port, msg.content(), onResult)) {
 						replyer(MakeReply<Reply>(eError, "send request failed."));
 					} else {
 						// success

--
Gitblit v1.8.0