[add] 删除namespace规则

This commit is contained in:
wujiawei
2025-06-16 00:34:06 +08:00
parent 2add2ddfa7
commit 513c8ba095
5 changed files with 7 additions and 9 deletions

View File

@@ -65,8 +65,6 @@ public class NettyTcpClientHandler extends SimpleChannelInboundHandler<NettyProx
nettyMsg.setType(TcpMessageType.TCP_CLIENT_CHANNEL_ACTIVE);
nettyMsg.setClientId(clientId);
channelTypeAdapter.handler(ctx, nettyMsg);
}
/**

View File

@@ -34,7 +34,7 @@ public class ChannelContext {
// 如果服务端已经存在 移除
if (cacheClientChannelConcurrentHashMap.containsKey(clientId)) {
List<Channel> existChannelList = new ArrayList<>();
List<Channel> oldChannels = cacheClientChannelConcurrentHashMap.getOrDefault(clientId, new ArrayList<>());
List<Channel> oldChannels = cacheClientChannelConcurrentHashMap.get(clientId);
for (Channel existChannel : oldChannels) {
if (existChannel != null) {
if (existChannel.isActive()) {
@@ -48,7 +48,7 @@ public class ChannelContext {
existChannelList.add(channel);
cacheClientChannelConcurrentHashMap.put(clientId, existChannelList);
} else {
cacheClientChannelConcurrentHashMap.put(clientId, Collections.synchronizedList(new ArrayList<>(List.of(channel))));
cacheClientChannelConcurrentHashMap.putIfAbsent(clientId, Collections.synchronizedList(new ArrayList<>(List.of(channel))));
}
}

View File

@@ -16,7 +16,7 @@ import java.nio.charset.StandardCharsets;
@Getter
public class NettyProxyMsg {
// body 长度 type 1 isSsl 1 appKey 4 appSecret 4 clientId 4 originalIp 4 targetIp 4 targetPort 4 visitorPort 4 visitorId 4 data 4
public static final int bodyLength = 1 + 1 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
public static final int bodyLength = 1 + 1 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
/**

View File

@@ -36,7 +36,6 @@ public class NettyTcpServerHandler extends SimpleChannelInboundHandler<NettyProx
}
/**
* Is called for each message of type {@link I}.
*
* @param ctx the {@link ChannelHandlerContext} which this {@link SimpleChannelInboundHandler}
* belongs to
@@ -144,6 +143,7 @@ public class NettyTcpServerHandler extends SimpleChannelInboundHandler<NettyProx
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
// super.exceptionCaught(ctx, cause);
Channel channel = ctx.channel();
log.error(cause.getMessage());
//……
if (channel.isActive()) ctx.close();
}

View File

@@ -36,7 +36,6 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<NettyProx
}
/**
* Is called for each message of type {@link I}.
*
* @param ctx the {@link ChannelHandlerContext} which this {@link SimpleChannelInboundHandler}
* belongs to
@@ -144,6 +143,7 @@ public class NettyUdpServerHandler extends SimpleChannelInboundHandler<NettyProx
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
// super.exceptionCaught(ctx, cause);
Channel channel = ctx.channel();
log.error(cause.getMessage());
//……
if (channel.isActive()) ctx.close();
}