This commit is contained in:
laodaming 2023-09-07 09:58:28 +08:00
parent b3e51d31c3
commit 648a19cb8c

View File

@ -70,7 +70,7 @@ var (
//用户标识的连接(白板用户不存)
mapUserConnPool = make(map[string]map[string]struct{}) //key是user_id +"_"+guest_id val是个普通map存储这个用户的所有连接标识
//用户标识的连接增删操作队列
mapUserConnPoolCtlChan = make(chan userConnPoolCtlChanItem, 2000)
userConnPoolCtlChan = make(chan userConnPoolCtlChanItem, 2000)
//每个websocket连接入口缓冲队列长度
websocketInChanLen = 1000
//每个websocket连接出口缓冲队列长度
@ -230,7 +230,7 @@ func createUserConnPoolElement(userId, guestId int64, uniqueId string) {
option: 1,
}
select {
case mapUserConnPoolCtlChan <- data:
case userConnPoolCtlChan <- data:
return
case <-time.After(time.Millisecond * 200):
return
@ -248,7 +248,7 @@ func deleteUserConnPoolElement(userId, guestId int64, uniqueId string) {
option: 0,
}
select {
case mapUserConnPoolCtlChan <- data:
case userConnPoolCtlChan <- data:
return
case <-time.After(time.Millisecond * 200):
return
@ -265,7 +265,7 @@ func sendToOutChanByUserIndex(userId, guestId int64, message []byte) {
option: 2,
}
select {
case mapUserConnPoolCtlChan <- data:
case userConnPoolCtlChan <- data:
return
case <-time.After(time.Millisecond * 200):
return
@ -287,7 +287,7 @@ func ConsumeUserPoolData(ctx context.Context) {
}()
for {
select {
case data := <-mapUserConnPoolCtlChan:
case data := <-userConnPoolCtlChan:
key := getmapUserConnPoolUniqueId(data.userId, data.guestId)
switch data.option {
case 2: //发送消息