fix: ws去除客户端读写互斥锁

This commit is contained in:
TsMask
2024-02-02 16:46:55 +08:00
parent f5b88d33bd
commit fb7a2dfa3c

View File

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