This commit is contained in:
laodaming 2023-09-06 17:18:52 +08:00
parent aa69cb2f4f
commit b4bc4ddcf7

View File

@ -70,7 +70,7 @@ var (
//用户标识的连接(白板用户不存)
mapUserConnPool = make(map[string]map[string]struct{}) //key是user_id +"_"+guest_id val是个普通map存储这个用户的所有连接标识
//用户标识的连接增删操作队列
mapUserConnPoolCtlChan = make(chan userConnPoolChanItem, 2000)
mapUserConnPoolCtlChan = make(chan userConnPoolCtlChanItem, 2000)
//每个websocket连接入口缓冲队列长度
websocketInChanLen = 1000
//每个websocket连接出口缓冲队列长度
@ -89,7 +89,7 @@ var (
)
// 用户标识的连接增删操作队列传输的值的结构
type userConnPoolChanItem struct {
type userConnPoolCtlChanItem struct {
userId int64 //必须两个用户id任意一个不为0
guestId int64 //必须两个用户id任意一个不为0
uniqueId string //主连接池唯一标识(添加/删除时候必须)
@ -221,7 +221,7 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
// 添加用户索引池ws连接
func createUserConnPoolElement(userId, guestId int64, uniqueId string) {
data := userConnPoolChanItem{
data := userConnPoolCtlChanItem{
userId: userId,
guestId: guestId,
uniqueId: uniqueId,
@ -239,7 +239,7 @@ func createUserConnPoolElement(userId, guestId int64, uniqueId string) {
// 从用户索引池删除ws连接
func deleteUserConnPoolElement(userId, guestId int64, uniqueId string) {
data := userConnPoolChanItem{
data := userConnPoolCtlChanItem{
userId: userId,
guestId: guestId,
uniqueId: uniqueId,
@ -257,7 +257,7 @@ func deleteUserConnPoolElement(userId, guestId int64, uniqueId string) {
// 根据用户索引发现链接并发送消息到出口队列
func sendToOutChanByUserIndex(userId, guestId int64, message []byte) {
data := userConnPoolChanItem{
data := userConnPoolCtlChanItem{
userId: userId,
guestId: guestId,
uniqueId: "",