diff --git a/pom.xml b/pom.xml index 1623896c..0d8dfef1 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ unknown - 4.0.0.CR1 + 4.0.0.CR3 UTF-8 diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index caa61223..8ea62e85 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -251,17 +251,24 @@ public class InitialHandler extends PacketHandler implements PendingConnection { return; } - thisState = InitialHandler.State.LOGIN; - unsafe().sendPacket( new PacketFCEncryptionResponse( new byte[ 0 ], new byte[ 0 ] ) ); - try + + ch.getHandle().eventLoop().execute( new Runnable() { - Cipher encrypt = EncryptionUtil.getCipher( Cipher.ENCRYPT_MODE, sharedKey ); - ch.getHandle().pipeline().addBefore( PipelineUtils.DECRYPT_HANDLER, PipelineUtils.ENCRYPT_HANDLER, new CipherEncoder( encrypt ) ); - } catch ( GeneralSecurityException ex ) - { - disconnect( "Cipher error: " + Util.exception( ex ) ); - } + @Override + public void run() + { + unsafe().sendPacket( new PacketFCEncryptionResponse( new byte[ 0 ], new byte[ 0 ] ) ); + try + { + Cipher encrypt = EncryptionUtil.getCipher( Cipher.ENCRYPT_MODE, sharedKey ); + ch.getHandle().pipeline().addBefore( PipelineUtils.DECRYPT_HANDLER, PipelineUtils.ENCRYPT_HANDLER, new CipherEncoder( encrypt ) ); + } catch ( GeneralSecurityException ex ) + { + disconnect( "Cipher error: " + Util.exception( ex ) ); + } + } + } ); } }; 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 3f208951..1ac7106d 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 @@ -28,7 +28,7 @@ public class PacketDecoder extends ReplayingDecoder private Protocol protocol; @Override - protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception + protected void decode(ChannelHandlerContext ctx, ByteBuf in, MessageBuf out) throws Exception { // While we have enough data while ( true ) @@ -53,10 +53,10 @@ public class PacketDecoder extends ReplayingDecoder // Store our decoded message if ( packet != null ) { - return( new PacketWrapper( packet, buf ) ); + out.add( new PacketWrapper( packet, buf ) ); } else { - return( buf ); + out.add( buf ); } } }