From 172b8bc75b0c5a114b15f7d62fcd05da3209d9db Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 4 Aug 2013 21:34:28 +1000 Subject: [PATCH] Update to Netty 4.0.6-Final --- pom.xml | 2 +- proxy/src/main/java/net/md_5/bungee/http/HttpHandler.java | 2 +- proxy/src/main/java/net/md_5/bungee/netty/ChannelWrapper.java | 3 +++ proxy/src/main/java/net/md_5/bungee/netty/CipherDecoder.java | 4 ++-- proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java | 4 +--- proxy/src/main/java/net/md_5/bungee/netty/PacketDecoder.java | 4 ++-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index c902877c..1a71e452 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ unknown - 4.0.0.CR9 + 4.0.6.Final UTF-8 diff --git a/proxy/src/main/java/net/md_5/bungee/http/HttpHandler.java b/proxy/src/main/java/net/md_5/bungee/http/HttpHandler.java index c7e4dcfc..fd486e04 100644 --- a/proxy/src/main/java/net/md_5/bungee/http/HttpHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/http/HttpHandler.java @@ -31,7 +31,7 @@ public class HttpHandler extends SimpleChannelInboundHandler } @Override - protected void messageReceived(ChannelHandlerContext ctx, HttpObject msg) throws Exception + protected void channelRead0(ChannelHandlerContext ctx, HttpObject msg) throws Exception { if ( msg instanceof HttpResponse ) { 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 81db19b7..9e5e8504 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 @@ -23,6 +23,7 @@ public class ChannelWrapper if ( !closed ) { ch.write( packet ); + ch.flush(); } } @@ -31,6 +32,7 @@ public class ChannelWrapper if ( !closed ) { closed = true; + ch.flush(); ch.close(); } } @@ -38,6 +40,7 @@ public class ChannelWrapper public void addBefore(String baseName, String name, ChannelHandler handler) { Preconditions.checkState( ch.eventLoop().inEventLoop(), "cannot add handler outside of event loop" ); + ch.pipeline().flush(); ch.pipeline().addBefore( baseName, name, handler ); } diff --git a/proxy/src/main/java/net/md_5/bungee/netty/CipherDecoder.java b/proxy/src/main/java/net/md_5/bungee/netty/CipherDecoder.java index 91fba349..e6fe7df9 100644 --- a/proxy/src/main/java/net/md_5/bungee/netty/CipherDecoder.java +++ b/proxy/src/main/java/net/md_5/bungee/netty/CipherDecoder.java @@ -2,8 +2,8 @@ package net.md_5.bungee.netty; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.MessageList; import io.netty.handler.codec.MessageToMessageDecoder; +import java.util.List; import javax.crypto.Cipher; public class CipherDecoder extends MessageToMessageDecoder @@ -17,7 +17,7 @@ public class CipherDecoder extends MessageToMessageDecoder } @Override - protected void decode(ChannelHandlerContext ctx, ByteBuf msg, MessageList out) throws Exception + protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List out) throws Exception { out.add( cipher.cipher( ctx, msg ) ); } 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 a6bd5b23..e4ea6fc6 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 @@ -3,7 +3,6 @@ package net.md_5.bungee.netty; import com.google.common.base.Preconditions; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; -import io.netty.channel.MessageList; import io.netty.handler.timeout.ReadTimeoutException; import java.io.IOException; import java.net.InetSocketAddress; @@ -61,9 +60,8 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter } @Override - public void messageReceived(ChannelHandlerContext ctx, MessageList msgs) throws Exception + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { - for ( Object msg : msgs ) { if ( handler != null ) { diff --git a/proxy/src/main/java/net/md_5/bungee/netty/PacketDecoder.java b/proxy/src/main/java/net/md_5/bungee/netty/PacketDecoder.java index 6c4ef785..670a7089 100644 --- a/proxy/src/main/java/net/md_5/bungee/netty/PacketDecoder.java +++ b/proxy/src/main/java/net/md_5/bungee/netty/PacketDecoder.java @@ -2,8 +2,8 @@ package net.md_5.bungee.netty; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.MessageList; import io.netty.handler.codec.ReplayingDecoder; +import java.util.List; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; @@ -28,7 +28,7 @@ public class PacketDecoder extends ReplayingDecoder private Protocol protocol; @Override - protected void decode(ChannelHandlerContext ctx, ByteBuf in, MessageList out) throws Exception + protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) throws Exception { // While we have enough data while ( true )