bugfix 修复报错

This commit is contained in:
Lemon
2026-03-21 10:40:59 +08:00
parent 14daa70064
commit 4aafe089ff

View File

@@ -117,6 +117,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
// 优化:增加消息处理耗时监控,用于排查性能问题
long elapsed = System.currentTimeMillis() - startTime;
// 从 AttributeKey 获取 frameType避免作用域问题
String frameType = ctx.channel().attr(LAST_FRAME_TYPE).get();
// 心跳帧(0x03)处理超过50ms警告其他帧超过200ms警告
int warnThreshold = "0x03".equals(frameType) ? 50 : 200;
if (elapsed > warnThreshold) {