【fix】修复服务端socks代理客户端时断时续问题

This commit is contained in:
wujiawei
2025-05-20 15:59:37 +08:00
parent 7f9cebec8a
commit c057d7b2d5
7 changed files with 16 additions and 12 deletions

View File

@ -26,7 +26,7 @@ public class NettyProxy2RealInboundHandler extends ChannelInboundHandlerAdapter
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
log.info("本地转发客户端的请求到代理服务器");
log.debug("本地转发客户端的请求到代理服务器");
if (dstChannelFuture.channel().isActive()) {
dstChannelFuture.channel().writeAndFlush(msg);
} else {
@ -37,7 +37,7 @@ public class NettyProxy2RealInboundHandler extends ChannelInboundHandlerAdapter
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
log.info("客户端与代理服务器的连接已经断开,即将断开代理服务器和目标服务器的连接");
log.debug("客户端与代理服务器的连接已经断开,即将断开代理服务器和目标服务器的连接");
if (dstChannelFuture.channel().isActive()) {
if (ctx.channel().isActive()) {
ctx.channel().writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);