From ab5004885ac5fa923219c3bce9a97286ad8443e6 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 23 Aug 2023 15:20:37 +0800 Subject: [PATCH] fix --- .../internal/logic/datatransferlogic.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index 81e478d2..099c5cd0 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -62,23 +62,23 @@ var ( } //websocket连接存储 mapConnPool = sync.Map{} - //公共互斥锁 + //公共互斥锁(复用连接标识用) publicMutex sync.Mutex ) // 每个连接的连接基本属性 type wsConnectItem struct { - conn *websocket.Conn //websocket的连接 - logic *DataTransferLogic //logic - closeChan chan struct{} //ws连接关闭chan - isClose bool //是否已经关闭 - uniqueId string //ws连接唯一标识 - inChan chan []byte //接受消息缓冲通道 - outChan chan []byte //发送回客户端的消息 - mutex sync.Mutex //互斥锁 - userId int64 //用户id - guestId int64 //游客id - renderProperty renderProperty //扩展云渲染属性 + conn *websocket.Conn //websocket的连接(基本属性) + logic *DataTransferLogic //logic(基本属性,用于获取上下文,配置或者操作数据库) + closeChan chan struct{} //ws连接关闭chan(基本属性) + isClose bool //是否已经关闭(基本属性) + uniqueId string //ws连接唯一标识(基本属性) + inChan chan []byte //接受消息缓冲通道(基本属性) + outChan chan []byte //发送回客户端的消息(基本属性) + mutex sync.Mutex //互斥锁(关闭连接方法中用) + userId int64 //用户id(基本属性) + guestId int64 //游客id(基本属性) + renderProperty renderProperty //扩展云渲染属性(扩展属性) } // 请求建立连接,升级websocket协议