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绑定列表