Merge branches 'develop' and 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
342d1f99ec
|
@ -85,7 +85,7 @@ type userConnPoolCtlChanItem struct {
|
|||
guestId int64 //必须(两个用户id任意一个不为0)
|
||||
uniqueId string //主连接池唯一标识(添加/删除时候必须)
|
||||
message []byte //消息(发送消息传的,格式是经过标准输出序列化后的数据)
|
||||
messageType constants.Websocket //消息类型(发送消息传的)
|
||||
//messageType constants.Websocket //消息类型(发送消息传的)
|
||||
option int64 //操作 2发消息 1增加 0删除
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ func ConsumeWebsocketConnectCountCtlChanData(ctx context.Context) {
|
|||
select {
|
||||
case num = <-websocketConnectCountCtlChan:
|
||||
currentWebsocketConnectCount += num
|
||||
logx.Info("当前websocket连接总数:", currentWebsocketConnectCount)
|
||||
//logx.Info("当前websocket连接总数:", currentWebsocketConnectCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,10 +86,12 @@ func (w *wsConnectItem) consumeRenderImageData() {
|
|||
case data := <-w.extendRenderProperty.renderChan: //消费数据
|
||||
//标签不一样
|
||||
if data.RenderData.TemplateTag != w.extendRenderProperty.templateTag {
|
||||
//logx.Info("标签不一致,丢弃消息")
|
||||
continue
|
||||
}
|
||||
//颜色不一致
|
||||
if data.RenderData.TemplateTagColor.SelectedColorIndex != w.extendRenderProperty.selectColorIndex {
|
||||
//logx.Info("颜色不一致,丢弃消息")
|
||||
continue
|
||||
}
|
||||
limitChan <- struct{}{}
|
||||
|
|
|
@ -70,7 +70,7 @@ func (r *reuseConnProcessor) allocationMessage(w *wsConnectItem, data []byte) {
|
|||
createUserConnPoolElement(w.userId, w.guestId, wid)
|
||||
rsp := w.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, wid)
|
||||
w.sendToOutChan(rsp)
|
||||
logx.Info("重新绑定websocket连接标识成功")
|
||||
//logx.Info("重新绑定websocket连接标识成功")
|
||||
}
|
||||
|
||||
// 获取用户拼接部分(复用标识用到)
|
||||
|
|
|
@ -23,7 +23,6 @@ func createUserConnPoolElement(userId, guestId int64, uniqueId string) {
|
|||
guestId: guestId,
|
||||
uniqueId: uniqueId,
|
||||
message: nil,
|
||||
messageType: "",
|
||||
option: 1,
|
||||
}
|
||||
select {
|
||||
|
@ -42,13 +41,9 @@ func deleteUserConnPoolElement(userId, guestId int64, uniqueId string) {
|
|||
guestId: guestId,
|
||||
uniqueId: uniqueId,
|
||||
message: nil,
|
||||
messageType: "",
|
||||
option: 0,
|
||||
}
|
||||
select {
|
||||
case userConnPoolCtlChan <- data:
|
||||
return
|
||||
}
|
||||
userConnPoolCtlChan <- data
|
||||
}
|
||||
|
||||
// 根据用户索引发现链接并发送(广播)消息到出口队列
|
||||
|
@ -89,7 +84,7 @@ func ConsumeUserConnPoolCtlChanData(ctx context.Context) {
|
|||
userKey = getmapUserConnPoolUniqueId(data.userId, data.guestId)
|
||||
switch data.option {
|
||||
case 2: //发送消息
|
||||
logx.Info("通过用户id索引发送消息")
|
||||
//logx.Info("通过用户id索引发送消息")
|
||||
mapUserUniqueId, ok := mapUserConnPool[userKey]
|
||||
if !ok {
|
||||
logx.Info("通过用户id索引发送消息,连接不存在,用户索引key:", userKey)
|
||||
|
@ -110,7 +105,7 @@ func ConsumeUserConnPoolCtlChanData(ctx context.Context) {
|
|||
originConn.sendToOutChan(data.message)
|
||||
}
|
||||
case 1: //添加
|
||||
logx.Info("添加用户id索引标识:", data.uniqueId)
|
||||
//logx.Info("添加用户id索引标识:", data.uniqueId)
|
||||
//存在这个用户的map池子
|
||||
if mapUserUniqueId, ok := mapUserConnPool[userKey]; ok {
|
||||
mapUserUniqueId[data.uniqueId] = struct{}{}
|
||||
|
@ -119,7 +114,7 @@ func ConsumeUserConnPoolCtlChanData(ctx context.Context) {
|
|||
mapUserConnPool[userKey][data.uniqueId] = struct{}{}
|
||||
}
|
||||
case 0: //删除
|
||||
logx.Info("删除用户id索引标识:", data.uniqueId)
|
||||
//logx.Info("删除用户id索引标识:", data.uniqueId)
|
||||
if mapUserUniqueId, ok := mapUserConnPool[userKey]; ok {
|
||||
delete(mapUserUniqueId, data.uniqueId)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package curl
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
|
@ -87,8 +86,8 @@ type (
|
|||
|
||||
// PostJson请求
|
||||
func (c *defaultClient) PostJson(jsonData interface{}, res interface{}) error {
|
||||
jsonDataB, _ := json.Marshal(jsonData)
|
||||
logc.Infof(c.ctx, "客户端名称 Client PostJson jsonData:%+v", string(jsonDataB))
|
||||
//jsonDataB, _ := json.Marshal(jsonData)
|
||||
//logc.Infof(c.ctx, "客户端名称 Client PostJson jsonData:%+v", string(jsonDataB))
|
||||
|
||||
logc.Infof(c.ctx, "客户端名称 请求开始时间:%+v", time.Now().UTC())
|
||||
resp, err := c.client.
|
||||
|
|
Loading…
Reference in New Issue
Block a user