fix: ws去除客户端读写互斥锁
This commit is contained in:
@@ -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绑定列表
|
||||
|
||||
Reference in New Issue
Block a user