Don't remove the legacy decoder if a legacy packet is found

Removing the decoder causes the bytebuf to be passed on to the next handler to be parsed normal packet which causes an error with legacy handshakes.
This commit is contained in:
Thinkofdeath 2014-01-05 17:06:07 +00:00
parent 986f52b1e1
commit 2100da2a9f

View File

@ -26,10 +26,12 @@ public class LegacyDecoder extends ByteToMessageDecoder
if ( b1 == 0xFE && b2 == 0x01 && b3 == 0xFA ) if ( b1 == 0xFE && b2 == 0x01 && b3 == 0xFA )
{ {
out.add( new PacketWrapper( new LegacyPing(), Unpooled.EMPTY_BUFFER ) ); out.add( new PacketWrapper( new LegacyPing(), Unpooled.EMPTY_BUFFER ) );
return;
} }
if ( b1 == 0x02 && b2 >= 60 && b2 <= 78 ) if ( b1 == 0x02 && b2 >= 60 && b2 <= 78 )
{ {
out.add( new PacketWrapper( new LegacyHandshake(), Unpooled.EMPTY_BUFFER ) ); out.add( new PacketWrapper( new LegacyHandshake(), Unpooled.EMPTY_BUFFER ) );
return;
} }
ctx.pipeline().remove( this ); ctx.pipeline().remove( this );
} }