From a3df1ad41bce6d8d3094014c6e369072e594e7be Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期一, 05 二月 2024 09:23:37 +0800
Subject: [PATCH] add func for performance

---
 api/bhsgo/bhome_node.go |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/api/bhsgo/bhome_node.go b/api/bhsgo/bhome_node.go
index b23125c..c3ce675 100644
--- a/api/bhsgo/bhome_node.go
+++ b/api/bhsgo/bhome_node.go
@@ -256,3 +256,30 @@
 func Cleanup() {
 	C.BHCleanup()
 }
+
+// ///////////////////////////////////////////////////
+func Request2(dest_addr *bh.BHAddress, data []byte, proc_id *string, replyPtr *unsafe.Pointer, replyLen *int, timeout_ms int) bool {
+	dest, _ := dest_addr.Marshal()
+	cpid := unsafe.Pointer(nil)
+	cpid_len := C.int(0)
+
+	creply := unsafe.Pointer(nil)
+	creply_len := C.int(0)
+
+	r := C.BHRequest(getPtr(&dest), C.int(len(dest)), getPtr(&data), C.int(len(data)), &cpid, &cpid_len, &creply, &creply_len, C.int(timeout_ms)) > 0
+	defer C.BHFree(cpid, cpid_len)
+	if r {
+		*proc_id = string(unsafeGetBytes(&cpid, int(cpid_len)))
+		*replyPtr = creply
+		*replyLen = int(creply_len)
+	}
+	return r
+}
+func CFree(p unsafe.Pointer, size int) {
+	if p != nil {
+		C.BHFree(p, C.int(size))
+	}
+}
+func SendReply2(src unsafe.Pointer, data []byte) bool {
+	return C.BHSendReply(src, getPtr(&data), C.int(len(data))) > 0
+}

--
Gitblit v1.8.0