fix
This commit is contained in:
parent
fc50bf587f
commit
e1094b9be6
|
@ -67,9 +67,9 @@ var (
|
||||||
//websocket连接存储
|
//websocket连接存储
|
||||||
mapConnPool = sync.Map{}
|
mapConnPool = sync.Map{}
|
||||||
//每个websocket连接入口缓冲队列长度默认值
|
//每个websocket连接入口缓冲队列长度默认值
|
||||||
websocketInChanLen = 500
|
websocketInChanLen = 1000
|
||||||
//每个websocket连接出口缓冲队列长度默认值
|
//每个websocket连接出口缓冲队列长度默认值
|
||||||
websocketOutChanLen = 500
|
websocketOutChanLen = 1000
|
||||||
//是否开启debug
|
//是否开启debug
|
||||||
openDebug = true
|
openDebug = true
|
||||||
//允许跨域的origin
|
//允许跨域的origin
|
||||||
|
@ -193,8 +193,6 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
|
||||||
guestId: userInfo.GuestId,
|
guestId: userInfo.GuestId,
|
||||||
extendRenderProperty: extendRenderProperty{
|
extendRenderProperty: extendRenderProperty{
|
||||||
renderChan: make(chan websocket_data.RenderImageReqMsg, renderChanLen),
|
renderChan: make(chan websocket_data.RenderImageReqMsg, renderChanLen),
|
||||||
colorSelectedIndex: 0,
|
|
||||||
templateTag: "",
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
//保存连接
|
//保存连接
|
||||||
|
|
|
@ -33,8 +33,6 @@ type renderProcessor struct {
|
||||||
// 云渲染属性
|
// 云渲染属性
|
||||||
type extendRenderProperty struct {
|
type extendRenderProperty struct {
|
||||||
renderChan chan websocket_data.RenderImageReqMsg //渲染消息入口的缓冲队列
|
renderChan chan websocket_data.RenderImageReqMsg //渲染消息入口的缓冲队列
|
||||||
colorSelectedIndex int //选择颜色索引
|
|
||||||
templateTag string //模板标签
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理分发到这里的数据
|
// 处理分发到这里的数据
|
||||||
|
@ -50,8 +48,6 @@ func (r *renderProcessor) allocationMessage(w *wsConnectItem, data []byte) {
|
||||||
case <-w.closeChan: //已经关闭
|
case <-w.closeChan: //已经关闭
|
||||||
return
|
return
|
||||||
case w.extendRenderProperty.renderChan <- renderImageData: //发入到缓冲队列
|
case w.extendRenderProperty.renderChan <- renderImageData: //发入到缓冲队列
|
||||||
w.extendRenderProperty.colorSelectedIndex = renderImageData.RenderData.TemplateTagColor.SelectedColorIndex
|
|
||||||
w.extendRenderProperty.templateTag = renderImageData.RenderData.TemplateTag
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,16 +67,6 @@ func (w *wsConnectItem) consumeRenderImageData() {
|
||||||
case <-w.closeChan: //已关闭
|
case <-w.closeChan: //已关闭
|
||||||
return
|
return
|
||||||
case data := <-w.extendRenderProperty.renderChan: //消费数据
|
case data := <-w.extendRenderProperty.renderChan: //消费数据
|
||||||
//属性不同则不发送渲染
|
|
||||||
if data.RenderData.TemplateTag != w.extendRenderProperty.templateTag {
|
|
||||||
logx.Info("丢弃切换了标签之前的渲染")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
//属性不同则不发送渲染
|
|
||||||
if data.RenderData.TemplateTagColor.SelectedColorIndex != w.extendRenderProperty.colorSelectedIndex {
|
|
||||||
logx.Info("丢弃切换了颜色之前的渲染")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
limitChan <- struct{}{}
|
limitChan <- struct{}{}
|
||||||
go func(d websocket_data.RenderImageReqMsg) {
|
go func(d websocket_data.RenderImageReqMsg) {
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user