From 1ff714838c03cba1a18884d5b48a20ee6c4275ac Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期五, 21 五月 2021 15:00:53 +0800
Subject: [PATCH] class MsgI, ShmMsgQueue, no bind to shm.

---
 src/shm_socket.h |   23 ++++-------------------
 1 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/src/shm_socket.h b/src/shm_socket.h
index 02500b2..bf78e89 100644
--- a/src/shm_socket.h
+++ b/src/shm_socket.h
@@ -66,22 +66,6 @@
 	bool Start(const RecvCB &onData, int nworker = 1) { return Start(nworker, onData); }
 	bool Stop();
 
-	template <class Body>
-	bool CenterSend(const MQInfo &remote, BHMsgHead &head, Body &body)
-	{
-		try {
-			//TODO alloc outsiez and use send.
-			MsgI msg;
-			if (!msg.Make(head, body)) { return false; }
-			DEFER1(msg.Release());
-
-			return Send(remote, msg);
-		} catch (...) {
-			SetLastError(eError, "Send internal error.");
-			return false;
-		}
-	}
-
 	bool RequestAlloc(const int64_t size, std::function<void(MsgI &msg)> const &onResult);
 
 	template <class Body>
@@ -155,9 +139,9 @@
 	bool Send(const MQInfo &remote, std::string &&content, const std::string &msg_id, RecvCB &&cb = RecvCB());
 
 	template <class... Rest>
-	bool SendImpl(const MQInfo &remote, Rest &&...rest)
+	bool SendImpl(Rest &&...rest)
 	{
-		return send_buffer_.Append(remote, std::forward<decltype(rest)>(rest)...);
+		return send_buffer_.Append(std::forward<decltype(rest)>(rest)...);
 	}
 
 	std::vector<std::thread> workers_;
@@ -188,12 +172,13 @@
 
 	Synced<CallbackRecords<std::string, RecvCB>> per_msg_cbs_;
 	Synced<CallbackRecords<int, RawRecvCB>> alloc_cbs_;
-	SendQ send_buffer_;
 
 	// node request center alloc memory.
 	int node_proc_index_ = -1;
 	int socket_index_ = -1;
 	std::atomic<int> alloc_id_;
+
+	SendQ send_buffer_;
 };
 
 #endif // end of include guard: SHM_SOCKET_GWTJHBPO

--
Gitblit v1.8.0