From 056f71f24cefaf88f2a93714c6678c03ed5f1e0e Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期五, 02 七月 2021 16:54:33 +0800
Subject: [PATCH] fixed to adapt gcc-5.4 & glibc-2.25
---
api/bhsgo/bhome_node.go | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/api/bhsgo/bhome_node.go b/api/bhsgo/bhome_node.go
index 6a91f34..09d571b 100644
--- a/api/bhsgo/bhome_node.go
+++ b/api/bhsgo/bhome_node.go
@@ -4,7 +4,7 @@
#include "bh_api_go.h"
*/
-// #cgo LDFLAGS: -L/home/lichao/code/shmsg/build/lib -L/usr/local/lib -lbhome_shmq -lbhome_msg -lprotobuf-lite -lstdc++ -lpthread -lrt
+// #cgo LDFLAGS: -L/home/lichao/code/shmsg/build/lib -L/usr/local/lib -lbhome_shmq -lstdc++ -lpthread -lrt
import "C"
import (
@@ -47,6 +47,11 @@
return bhApiIn1Out1(C.FBHApiIn1Out1(C.BHSubscribeTopics), data, reply, timeout_ms)
}
+func SubscribeNet(topics *bh.MsgTopicList, reply *bh.MsgCommonReply, timeout_ms int) bool {
+ data, _ := topics.Marshal()
+ return bhApiIn1Out1(C.FBHApiIn1Out1(C.BHSubscribeNetTopics), data, reply, timeout_ms)
+}
+
func Heartbeat(proc *bh.ProcInfo, reply *bh.MsgCommonReply, timeout_ms int) bool {
data, _ := proc.Marshal()
return bhApiIn1Out1(C.FBHApiIn1Out1(C.BHHeartbeat), data, reply, timeout_ms)
@@ -75,6 +80,20 @@
}
+func QueryProcs(dest_addr *bh.BHAddress, topic *bh.MsgQueryProc, reply *bh.MsgQueryProcReply, timeout_ms int) bool {
+ dest, _ := dest_addr.Marshal()
+ data, _ := topic.Marshal()
+ creply := unsafe.Pointer(nil)
+ creply_len := C.int(0)
+ defer C.BHFree(creply, creply_len)
+ r := C.BHQueryProcs(getPtr(&dest), C.int(len(dest)), getPtr(&data), C.int(len(data)), &creply, &creply_len, C.int(timeout_ms)) > 0
+ if r {
+ reply.Unmarshal(C.GoBytes(creply, creply_len))
+ }
+ return r
+
+}
+
func Publish(pub *bh.MsgPublish, timeout_ms int) bool {
data, _ := pub.Marshal()
return C.BHPublish(getPtr(&data), C.int(len(data)), C.int(timeout_ms)) > 0
--
Gitblit v1.8.0