From 05ebbebc7c25cc081993960fb5eea10ddcb308d3 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 2 Dec 2022 20:57:53 +0800 Subject: [PATCH] update tcp connect --- internal/connect/tcp_server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/connect/tcp_server.go b/internal/connect/tcp_server.go index 04d630a..35fb872 100644 --- a/internal/connect/tcp_server.go +++ b/internal/connect/tcp_server.go @@ -55,7 +55,7 @@ func (*handler) OnMessage(c *gn.Conn, bytes []byte) { func (*handler) OnClose(c *gn.Conn, err error) { conn, ok := c.GetData().(*Conn) - if !ok { + if !ok || conn == nil { return } logger.Logger.Debug("close", zap.String("addr", c.GetAddr()), zap.Int64("user_id", conn.UserId),