解决上传文件卡住的问题

This commit is contained in:
aoshiguchen
2023-10-17 15:06:43 +08:00
parent 9c0b3f3086
commit a9608a449d
2 changed files with 5 additions and 5 deletions
@@ -25,7 +25,7 @@ public class ProxyMessageTransferHandler implements ProxyMessageHandler {
if (realServerChannel != null) {
// 自己可写,则设置来源可读。自己不可写,则设置来源不可读
realServerChannel.config().setAutoRead(ctx.channel().isWritable());
ctx.channel().config().setAutoRead(realServerChannel.isWritable());
ByteBuf buf = ctx.alloc().buffer(proxyMessage.getData().length);
buf.writeBytes(proxyMessage.getData());
@@ -70,10 +70,10 @@ public class ProxyTunnelChannelHandler extends SimpleChannelInboundHandler<Proxy
@Override
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
// Channel userChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
// if (userChannel != null) {
// userChannel.config().setOption(ChannelOption.AUTO_READ, ctx.channel().isWritable());
// }
Channel visitorChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
if (visitorChannel != null) {
visitorChannel.config().setOption(ChannelOption.AUTO_READ, ctx.channel().isWritable());
}
super.channelWritabilityChanged(ctx);
}