From ca319178f45ce6256aed7913565d445571f6db22 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期二, 20 四月 2021 11:04:07 +0800
Subject: [PATCH] add go api, wrap C api, not finished.

---
 src/shm_queue.cpp |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/shm_queue.cpp b/src/shm_queue.cpp
index 2006496..78fdaec 100644
--- a/src/shm_queue.cpp
+++ b/src/shm_queue.cpp
@@ -69,9 +69,13 @@
 	return Super::Remove(shm, MsgQIdToName(id));
 }
 
+ShmMsgQueue::Queue *ShmMsgQueue::FindRemote(SharedMemory &shm, const MQId &remote_id)
+{
+	return Find(shm, MsgQIdToName(remote_id));
+}
 bool ShmMsgQueue::Send(SharedMemory &shm, const MQId &remote_id, const MsgI &msg, const int timeout_ms, OnSend const &onsend)
 {
-	Queue *remote = Find(shm, MsgQIdToName(remote_id));
+	Queue *remote = FindRemote(shm, remote_id);
 	if (remote) {
 		if (onsend) {
 			return remote->Write(msg, timeout_ms, [&onsend](const MsgI &msg) { onsend(); msg.AddRef(); });
@@ -86,7 +90,7 @@
 
 bool ShmMsgQueue::TrySend(SharedMemory &shm, const MQId &remote_id, const MsgI &msg, OnSend const &onsend)
 {
-	Queue *remote = Find(shm, MsgQIdToName(remote_id));
+	Queue *remote = FindRemote(shm, remote_id);
 	if (remote) {
 		if (onsend) {
 			return remote->TryWrite(msg, [&onsend](const MsgI &msg) { onsend(); msg.AddRef(); });

--
Gitblit v1.8.0