#2529: Use single legacy kicker instance for all channels
This commit is contained in:
parent
9886021428
commit
41f8eb68c9
@ -1,9 +1,11 @@
|
|||||||
package net.md_5.bungee.protocol;
|
package net.md_5.bungee.protocol;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.handler.codec.MessageToByteEncoder;
|
import io.netty.handler.codec.MessageToByteEncoder;
|
||||||
|
|
||||||
|
@ChannelHandler.Sharable
|
||||||
public class KickStringWriter extends MessageToByteEncoder<String>
|
public class KickStringWriter extends MessageToByteEncoder<String>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class PipelineUtils
|
|||||||
ch.pipeline().addBefore( FRAME_DECODER, LEGACY_DECODER, new LegacyDecoder() );
|
ch.pipeline().addBefore( FRAME_DECODER, LEGACY_DECODER, new LegacyDecoder() );
|
||||||
ch.pipeline().addAfter( FRAME_DECODER, PACKET_DECODER, new MinecraftDecoder( Protocol.HANDSHAKE, true, ProxyServer.getInstance().getProtocolVersion() ) );
|
ch.pipeline().addAfter( FRAME_DECODER, PACKET_DECODER, new MinecraftDecoder( Protocol.HANDSHAKE, true, ProxyServer.getInstance().getProtocolVersion() ) );
|
||||||
ch.pipeline().addAfter( FRAME_PREPENDER, PACKET_ENCODER, new MinecraftEncoder( Protocol.HANDSHAKE, true, ProxyServer.getInstance().getProtocolVersion() ) );
|
ch.pipeline().addAfter( FRAME_PREPENDER, PACKET_ENCODER, new MinecraftEncoder( Protocol.HANDSHAKE, true, ProxyServer.getInstance().getProtocolVersion() ) );
|
||||||
ch.pipeline().addBefore( FRAME_PREPENDER, LEGACY_KICKER, new KickStringWriter() );
|
ch.pipeline().addBefore( FRAME_PREPENDER, LEGACY_KICKER, legacyKicker );
|
||||||
ch.pipeline().get( HandlerBoss.class ).setHandler( new InitialHandler( BungeeCord.getInstance(), listener ) );
|
ch.pipeline().get( HandlerBoss.class ).setHandler( new InitialHandler( BungeeCord.getInstance(), listener ) );
|
||||||
|
|
||||||
if ( listener.isProxyProtocol() )
|
if ( listener.isProxyProtocol() )
|
||||||
@ -66,6 +66,7 @@ public class PipelineUtils
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
public static final Base BASE = new Base();
|
public static final Base BASE = new Base();
|
||||||
|
private static final KickStringWriter legacyKicker = new KickStringWriter();
|
||||||
private static final Varint21LengthFieldPrepender framePrepender = new Varint21LengthFieldPrepender();
|
private static final Varint21LengthFieldPrepender framePrepender = new Varint21LengthFieldPrepender();
|
||||||
public static final String TIMEOUT_HANDLER = "timeout";
|
public static final String TIMEOUT_HANDLER = "timeout";
|
||||||
public static final String PACKET_DECODER = "packet-decoder";
|
public static final String PACKET_DECODER = "packet-decoder";
|
||||||
|
Loading…
Reference in New Issue
Block a user