From 911f08d52c0cf8803a28e74c893f582dceb73622 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 31 Jul 2013 20:18:54 +1000 Subject: [PATCH] Disable packet grouping in an attempt to increase reliability. --- .../net/md_5/bungee/netty/ChannelWrapper.java | 16 +--------------- .../java/net/md_5/bungee/netty/HandlerBoss.java | 2 -- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java b/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java index 25504359..e48aa874 100644 --- a/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java +++ b/proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java @@ -12,7 +12,6 @@ public class ChannelWrapper private final Channel ch; @Getter private volatile boolean closed; - private boolean flushNow = true; public ChannelWrapper(ChannelHandlerContext ctx) { @@ -23,23 +22,10 @@ public class ChannelWrapper { if ( !closed ) { - ch.write( packet ); - if ( flushNow ) - { - ch.flush(); - } + ch.writeAndFlush( packet ); } } - public synchronized void flushNow(boolean flush) - { - if ( !flushNow && flush ) - { - ch.flush(); - } - this.flushNow = flush; - } - public synchronized void close() { if ( !closed ) diff --git a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java index 76e5941f..7095f18a 100644 --- a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java +++ b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java @@ -69,7 +69,6 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter @Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { - channel.flushNow( false ); while ( !msgs.isEmpty() ) { Object msg = msgs.remove(); @@ -95,7 +94,6 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter } } } - channel.flushNow( true ); } @Override