From fb7a2dfa3c3ad7ded0e91ed4f8a6376e2b413549 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Fri, 2 Feb 2024 16:46:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ws=E5=8E=BB=E9=99=A4=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E8=AF=BB=E5=86=99=E4=BA=92=E6=96=A5=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/ws/service/ws.impl.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/modules/ws/service/ws.impl.go b/src/modules/ws/service/ws.impl.go index 36409894..6dfb236b 100644 --- a/src/modules/ws/service/ws.impl.go +++ b/src/modules/ws/service/ws.impl.go @@ -14,8 +14,6 @@ import ( ) var ( - // ws客户端读写互斥锁 - mutex sync.Mutex // ws客户端 [clientId: client] WsClients sync.Map // ws用户对应的多个客户端id [uid:clientIds] @@ -161,7 +159,6 @@ func (s *WSImpl) clientWrite(wsClient *model.WSClient) { // CloseClient 客户端关闭 func (s *WSImpl) CloseClient(clientID string) { - mutex.Lock() v, ok := WsClients.Load(clientID) if !ok { return @@ -173,7 +170,6 @@ func (s *WSImpl) CloseClient(clientID string) { client.Conn.Close() client.StopChan <- struct{}{} WsClients.Delete(clientID) - mutex.Unlock() }() // 客户端断线时自动踢出Uid绑定列表