【fix】注释udp、通道关闭验证通道关联通道是否存在

This commit is contained in:
wujiawei
2025-07-15 16:20:06 +08:00
parent e387a43437
commit 841c24a6ed
3 changed files with 10 additions and 5 deletions

View File

@@ -15,7 +15,7 @@ import org.framework.lazy.cloud.network.heartbeat.server.properties.ServerNodePr
import org.springframework.stereotype.Component;
@Slf4j
@Component
//@Component
public class NettyUdpServerSocketApplicationListener implements SocketApplicationListener {
private final EventLoopGroup bossGroup = "linux".equalsIgnoreCase(SystemPropertyUtil.get("os.name")) ? new EpollEventLoopGroup() : new NioEventLoopGroup();

View File

@@ -16,7 +16,8 @@ import org.springframework.context.annotation.Import;
*/
@Slf4j
@Configuration
@Import({NettyTcpServerSocketApplicationListener.class, NettyUdpServerSocketApplicationListener.class})
@Import({NettyTcpServerSocketApplicationListener.class})
//@Import({NettyTcpServerSocketApplicationListener.class, NettyUdpServerSocketApplicationListener.class})
public class InitServerSocket {

View File

@@ -119,12 +119,16 @@ public class NettyTcpServerHandler extends SimpleChannelInboundHandler<NettyProx
log.warn("client: {} channel:{}, disconnect with visitorId:{}", clientId, channel.id().toString(), visitorId);
// 访客通道 关闭访客通道
NettyCommunicationIdContext.clear(visitorId);
// 关闭通信通道
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
Channel transferNextChannel = ChannelAttributeKeyUtils.getTransferNextChannel(channel);
// 关闭通信通道
channel.close();
nextChannel.close();
transferNextChannel.close();
if (ObjectUtils.isNotEmpty(nextChannel)) {
nextChannel.close();
}
if (ObjectUtils.isNotEmpty(transferNextChannel)) {
transferNextChannel.close();
}
super.channelInactive(ctx);
} else if (!ObjectUtils.isEmpty(clientId)) {
// 断开客户端的连接:{}