From 98583009847efc5cbac92abc24108f49837728b1 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Sat, 7 Oct 2023 15:44:44 +0800 Subject: [PATCH 1/4] 11 --- server/websocket/internal/logic/ws_render_image.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index da1e175e..cfd15193 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -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{}{} From 34b2aef7634ece1a4b0bd84758adcd23813ea35a Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Sat, 7 Oct 2023 15:55:12 +0800 Subject: [PATCH 2/4] 11 --- utils/curl/client_resty.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/utils/curl/client_resty.go b/utils/curl/client_resty.go index 84177bec..aa3a2311 100644 --- a/utils/curl/client_resty.go +++ b/utils/curl/client_resty.go @@ -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. From 67fe103ac161675bad31bf01ea42c3e199710aab Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Sat, 7 Oct 2023 16:03:54 +0800 Subject: [PATCH 3/4] 11 --- server/websocket/internal/logic/ws_connect_statistics.go | 2 +- server/websocket/internal/logic/ws_render_image.go | 4 ++-- server/websocket/internal/logic/ws_reuse_last_connect.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/websocket/internal/logic/ws_connect_statistics.go b/server/websocket/internal/logic/ws_connect_statistics.go index a1ea9731..226d1550 100644 --- a/server/websocket/internal/logic/ws_connect_statistics.go +++ b/server/websocket/internal/logic/ws_connect_statistics.go @@ -40,7 +40,7 @@ func ConsumeWebsocketConnectCountCtlChanData(ctx context.Context) { select { case num = <-websocketConnectCountCtlChan: currentWebsocketConnectCount += num - logx.Info("当前websocket连接总数:", currentWebsocketConnectCount) + //logx.Info("当前websocket连接总数:", currentWebsocketConnectCount) } } } diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index cfd15193..a9a7b005 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -86,12 +86,12 @@ func (w *wsConnectItem) consumeRenderImageData() { case data := <-w.extendRenderProperty.renderChan: //消费数据 //标签不一样 if data.RenderData.TemplateTag != w.extendRenderProperty.templateTag { - logx.Info("标签不一致,丢弃消息") + //logx.Info("标签不一致,丢弃消息") continue } //颜色不一致 if data.RenderData.TemplateTagColor.SelectedColorIndex != w.extendRenderProperty.selectColorIndex { - logx.Info("颜色不一致,丢弃消息") + //logx.Info("颜色不一致,丢弃消息") continue } limitChan <- struct{}{} diff --git a/server/websocket/internal/logic/ws_reuse_last_connect.go b/server/websocket/internal/logic/ws_reuse_last_connect.go index f788b8fd..8dbe13ca 100644 --- a/server/websocket/internal/logic/ws_reuse_last_connect.go +++ b/server/websocket/internal/logic/ws_reuse_last_connect.go @@ -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连接标识成功") } // 获取用户拼接部分(复用标识用到) From 7fa7b868ca22657975697cbffaf508bf0f4c5717 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Sat, 7 Oct 2023 16:10:51 +0800 Subject: [PATCH 4/4] 11 --- .../internal/logic/datatransferlogic.go | 12 +++---- .../internal/logic/ws_user_connect_pool.go | 33 ++++++++----------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index f313acc6..ac99c474 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -81,12 +81,12 @@ var ( // 用户标识的连接增删操作队列传输的值的结构 type userConnPoolCtlChanItem struct { - userId int64 //必须(两个用户id任意一个不为0) - guestId int64 //必须(两个用户id任意一个不为0) - uniqueId string //主连接池唯一标识(添加/删除时候必须) - message []byte //消息(发送消息传的,格式是经过标准输出序列化后的数据) - messageType constants.Websocket //消息类型(发送消息传的) - option int64 //操作 2发消息 1增加 0删除 + userId int64 //必须(两个用户id任意一个不为0) + guestId int64 //必须(两个用户id任意一个不为0) + uniqueId string //主连接池唯一标识(添加/删除时候必须) + message []byte //消息(发送消息传的,格式是经过标准输出序列化后的数据) + //messageType constants.Websocket //消息类型(发送消息传的) + option int64 //操作 2发消息 1增加 0删除 } // 每个连接的连接基本属性 diff --git a/server/websocket/internal/logic/ws_user_connect_pool.go b/server/websocket/internal/logic/ws_user_connect_pool.go index 8f02bb1d..a83fd8ed 100644 --- a/server/websocket/internal/logic/ws_user_connect_pool.go +++ b/server/websocket/internal/logic/ws_user_connect_pool.go @@ -19,12 +19,11 @@ func createUserConnPoolElement(userId, guestId int64, uniqueId string) { return } data := userConnPoolCtlChanItem{ - userId: userId, - guestId: guestId, - uniqueId: uniqueId, - message: nil, - messageType: "", - option: 1, + userId: userId, + guestId: guestId, + uniqueId: uniqueId, + message: nil, + option: 1, } select { case userConnPoolCtlChan <- data: @@ -38,17 +37,13 @@ func deleteUserConnPoolElement(userId, guestId int64, uniqueId string) { return } data := userConnPoolCtlChanItem{ - userId: userId, - guestId: guestId, - uniqueId: uniqueId, - message: nil, - messageType: "", - option: 0, - } - select { - case userConnPoolCtlChan <- data: - return + userId: userId, + guestId: guestId, + uniqueId: uniqueId, + message: nil, + option: 0, } + 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) }