From 7ecd6323ffedbfef92c87c02b2a8680dd53b772c Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期四, 06 五月 2021 19:37:50 +0800 Subject: [PATCH] rename atomic queue io function. --- api/bhsgo/bhome_node_test.go | 21 +++++++++++++++++++-- 1 files changed, 19 insertions(+), 2 deletions(-) diff --git a/api/bhsgo/bhome_node_test.go b/api/bhsgo/bhome_node_test.go index 3629d89..d2720a3 100644 --- a/api/bhsgo/bhome_node_test.go +++ b/api/bhsgo/bhome_node_test.go @@ -1,11 +1,12 @@ package bhsgo import ( - bh "bhshmq/proto/source/bhome_msg" "fmt" "testing" "time" "unsafe" + + bh "basic.com/valib/bhshmq.git/proto/source/bhome_msg" ) func ServerCallback(src unsafe.Pointer, proc_id *string, req *bh.MsgRequestTopic) { @@ -26,10 +27,25 @@ proc := bh.ProcInfo{} proc.ProcId = []byte(proc_id) reply := bh.MsgCommonReply{} + defer Cleanup() StartWorker(ClientCallback, ServerCallback, SubDataCallback) r := Register(&proc, &reply, 1000) + if r { + fmt.Println("register ok") + } else { + fmt.Println("register failed") + return + } + r = Unregister(&proc, &reply, 1000) + if r { + fmt.Println("Unregister ok") + } else { + fmt.Println("Unregister failed") + } + + r = Register(&proc, &reply, 1000) if r { fmt.Println("register ok") } else { @@ -64,8 +80,9 @@ pid := "" rr := bh.MsgRequestTopicReply{} + dest := bh.BHAddress{} for i := 0; i < 10000; i++ { - if Request(&req, &pid, &rr, 3000) { + if Request(&dest, &req, &pid, &rr, 3000) { fmt.Println("server:" + pid + ", reply:" + string(rr.Data)) } else { e, s := GetLastError() -- Gitblit v1.8.0