tcp数据粘包处理
This commit is contained in:
@@ -119,6 +119,7 @@ public class AgentDecoderHandler extends ChannelInboundHandlerAdapter {
|
|||||||
if(endsWith){
|
if(endsWith){
|
||||||
content = content.replaceAll("agent-client:","");
|
content = content.replaceAll("agent-client:","");
|
||||||
String[] arr = content.split("@tong-ran");
|
String[] arr = content.split("@tong-ran");
|
||||||
|
try {
|
||||||
for (String message : arr) {
|
for (String message : arr) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(message);
|
JSONObject jsonObject = JSONObject.parseObject(message);
|
||||||
String clientId = jsonObject.getString("clientId");
|
String clientId = jsonObject.getString("clientId");
|
||||||
@@ -140,6 +141,9 @@ public class AgentDecoderHandler extends ChannelInboundHandlerAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
AssertLog.error("=====channelRead:{}=====" + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isClear) {
|
if (isClear) {
|
||||||
lruCache.remove(sessionManager.client(ctx));
|
lruCache.remove(sessionManager.client(ctx));
|
||||||
|
|||||||
Reference in New Issue
Block a user