From cf05ea3d9f43e4e84d621e1f9d54cbef552b6e2b Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期二, 18 五月 2021 16:53:28 +0800
Subject: [PATCH] fix center init mutex.

---
 api/bhsgo/bhome_node_test.go |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/api/bhsgo/bhome_node_test.go b/api/bhsgo/bhome_node_test.go
index b00b1fe..d2720a3 100644
--- a/api/bhsgo/bhome_node_test.go
+++ b/api/bhsgo/bhome_node_test.go
@@ -1,11 +1,12 @@
 package bhsgo
 
 import (
-	bh "basic.com/valib/bhshmq.git/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,6 +27,7 @@
 	proc := bh.ProcInfo{}
 	proc.ProcId = []byte(proc_id)
 	reply := bh.MsgCommonReply{}
+	defer Cleanup()
 
 	StartWorker(ClientCallback, ServerCallback, SubDataCallback)
 
@@ -34,6 +36,20 @@
 		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 {
+		fmt.Println("register failed")
 		t.Log("register error")
 		return
 	}

--
Gitblit v1.8.0