From 60cba9f7839cc2a1705eacc555bc8ed5eb9dfd9a Mon Sep 17 00:00:00 2001 From: huchenyang Date: Tue, 17 Aug 2021 22:48:56 +0800 Subject: [PATCH 1/2] update zinx client example --- examples/zinx_client/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/zinx_client/main.go b/examples/zinx_client/main.go index abb7410..9d14cdf 100644 --- a/examples/zinx_client/main.go +++ b/examples/zinx_client/main.go @@ -56,7 +56,7 @@ func main() { return } - // fmt.Println("==> Test Router:[Ping] Recv Msg: ID=", msg.Id ", len=", msg.DataLen, ", data=", string(msg.Data)) + fmt.Println("==> Test Router:[Ping] Recv Msg: ID=", msg.ID, ", len=", msg.DataLen, ", data=", string(msg.Data)) } time.Sleep(1 * time.Second) From b396345a22dfa9c9c28eeff9e8ef2c1dbcdf6de5 Mon Sep 17 00:00:00 2001 From: huchenyang Date: Tue, 17 Aug 2021 22:51:11 +0800 Subject: [PATCH 2/2] bugfix: fix issue [#117] --- znet/connection.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/znet/connection.go b/znet/connection.go index df307cb..ede5239 100644 --- a/znet/connection.go +++ b/znet/connection.go @@ -158,12 +158,13 @@ func (c *Connection) Start() { //Stop 停止连接,结束当前连接状态M func (c *Connection) Stop() { - c.Lock() - defer c.Unlock() //如果用户注册了该链接的关闭回调业务,那么在此刻应该显示调用 c.TCPServer.CallOnConnStop(c) + c.Lock() + defer c.Unlock() + //如果当前链接已经关闭 if c.isClosed == true { return