TCP数据包优化

This commit is contained in:
qiminbao
2025-09-23 11:30:51 +08:00
parent 86415bf526
commit c139da0d91
3 changed files with 10 additions and 6 deletions
@@ -101,6 +101,12 @@ public class AgentEndpoint {
} catch (Exception e) {
e.printStackTrace();
}
AssertLog.info("SWITCH_NET_OID={}",JSON.toJSONString(GlobalConfig.SWITCH_NET_OID));
AssertLog.info("SWITCH_MODULE_OID={}",JSON.toJSONString(GlobalConfig.SWITCH_MODULE_OID));
AssertLog.info("SWITCH_MPU_OID={}",JSON.toJSONString(GlobalConfig.SWITCH_MPU_OID));
AssertLog.info("SWITCH_PWR_OID={}",JSON.toJSONString(GlobalConfig.SWITCH_PWR_OID));
AssertLog.info("SWITCH_FAN_OID={}",JSON.toJSONString(GlobalConfig.SWITCH_FAN_OID));
AssertLog.info("SWITCH_OTHER_OID={}",JSON.toJSONString(GlobalConfig.SWITCH_OTHER_OID));
long timestamp = System.currentTimeMillis();
timestamp = Math.round(timestamp / 1000.0);
JSONObject json = new JSONObject();
@@ -74,7 +74,7 @@ public class AgentDecoderHandler extends ChannelInboundHandlerAdapter {
tmpMsgSize = 0;
sb.append(arr_msg[0]);
// content = arr_msg[0];
lruCache.put(sessionManager.client(ctx), content, DateUnit.SECOND.getMillis() * 3000);
lruCache.put(sessionManager.client(ctx), sb.toString(), DateUnit.SECOND.getMillis() * 3000);
}
}
//判定是否粘包
@@ -395,9 +395,9 @@ public class SwitchBoardServiceImpl implements SwitchBoardService {
}
String[] ifOIDs = oidParams.keySet().toArray(new String[0]);
String[] params = oidParams.values().toArray(new String[0]);
if(!StringUtils.equals(type,"switchNetCollect") && !StringUtils.equals(type,"switchModuleCollect")
&& !StringUtils.equals(type,"switchMpuCollect") && !StringUtils.equals(type,"switchPwrCollect")
&& !StringUtils.equals(type,"switchFanCollect")){
if(!StringUtils.equals(type,"switchNet") && !StringUtils.equals(type,"switchModule")
&& !StringUtils.equals(type,"switchMpu") && !StringUtils.equals(type,"switchPwr")
&& !StringUtils.equals(type,"switchFan")){
String os = "";
String ps = "";
for (int i = 0; i < params.length; i++) {
@@ -411,8 +411,6 @@ public class SwitchBoardServiceImpl implements SwitchBoardService {
}
}
}
Arrays.fill(ifOIDs, null);
Arrays.fill(params, null);
ifOIDs = os.split(",");
params = ps.split(",");
}