From 1b52f1cb8c47dd2c0195d2fd65d7b6a4c2f10704 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期一, 12 四月 2021 18:29:41 +0800
Subject: [PATCH] add fail-resend support.

---
 src/shm_queue.h |   24 ++++--------------------
 1 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/src/shm_queue.h b/src/shm_queue.h
index ab8a88c..20ff3dc 100644
--- a/src/shm_queue.h
+++ b/src/shm_queue.h
@@ -129,32 +129,16 @@
 	ShmMsgQueue(const MQId &id, ShmType &segment, const int len);
 	ShmMsgQueue(ShmType &segment, const int len);
 	~ShmMsgQueue();
+	static bool Remove(SharedMemory &shm, const MQId &id);
 	const MQId &Id() const { return id_; }
 
-	bool Recv(BHMsg &msg, const int timeout_ms);
+	// bool Recv(MsgI &msg, BHMsgHead &head, const int timeout_ms);
 	bool Recv(MsgI &msg, const int timeout_ms) { return Read(msg, timeout_ms); }
 	static bool Send(SharedMemory &shm, const MQId &remote_id, const MsgI &msg, const int timeout_ms, OnSend const &onsend);
 	static bool Send(SharedMemory &shm, const MQId &remote_id, const MsgI &msg, const int timeout_ms);
 
-	template <class... Extra>
-	bool Send(const MQId &remote_id, const MsgI &msg, const int timeout_ms, Extra const &...extra)
-	{
-		return Send(shm(), remote_id, msg, timeout_ms, extra...);
-	}
-
-	template <class... Extra>
-	bool Send(const MQId &remote_id, const BHMsg &data, const int timeout_ms, Extra const &...extra)
-	{
-		MsgI msg;
-		if (msg.Make(shm(), data)) {
-			if (Send(shm(), remote_id, msg, timeout_ms, extra...)) {
-				return true;
-			} else {
-				msg.Release(shm());
-			}
-		}
-		return false;
-	}
+	template <class... Rest>
+	bool Send(const MQId &remote_id, Rest const &...rest) { return Send(shm(), remote_id, rest...); }
 	size_t Pending() const { return data()->size(); }
 };
 

--
Gitblit v1.8.0