增加日志

This commit is contained in:
aoshiguchen
2026-01-26 15:44:27 +08:00
parent 2104f829ef
commit f83f9e45a4
3 changed files with 4 additions and 0 deletions
@@ -54,6 +54,7 @@ public class ProxyTunnelChannelHandler extends SimpleChannelInboundHandler<Proxy
Channel visitorChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
if (visitorChannel != null) {
visitorChannel.config().setOption(ChannelOption.AUTO_READ, ctx.channel().isWritable());
// visitorChannel.config().setAutoRead(ctx.channel().isWritable());
}
super.channelWritabilityChanged(ctx);
@@ -157,6 +157,7 @@ public class TcpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteBu
Channel proxyChannel = visitorChannel.attr(Constants.NEXT_CHANNEL).get();
if (null != proxyChannel) {
proxyChannel.config().setOption(ChannelOption.AUTO_READ, visitorChannel.isWritable());
// proxyChannel.config().setAutoRead(visitorChannel.isWritable());
}
}
@@ -38,6 +38,8 @@ public class ProxyMessageTransferHandler implements ProxyMessageHandler {
ctx.channel().config().setAutoRead(true);
}
}
// TODO Netty默认的高水位通常只有64KB,在SCP/SFTP场景下可能很快就填满了。
// 而visitorChannel.writeAndFlush(buf);是异步的。有可能写入数据极快,而visitorChannel的isWritable还没来得及变成false,此处就会写入大量数据把缓冲撑爆。
ByteBuf buf = ctx.alloc().buffer(proxyMessage.getData().length);
buf.writeBytes(proxyMessage.getData());
visitorChannel.writeAndFlush(buf);