mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-12-23 00:47:39 +01:00
Cancel Bungee packet encoding when closed (#2448)
This commit is contained in:
parent
ad0842c107
commit
f18e2b3875
@ -40,6 +40,10 @@ public class BungeeChannelInitializer extends ChannelInitializer<Channel> {
|
||||
|
||||
@Override
|
||||
protected void initChannel(Channel socketChannel) throws Exception {
|
||||
if (!socketChannel.isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
UserConnection info = new UserConnection(socketChannel);
|
||||
// init protocol
|
||||
new ProtocolPipeline(info);
|
||||
|
@ -37,6 +37,10 @@ public class BungeeDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
|
||||
|
||||
@Override
|
||||
protected void decode(final ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> out) throws Exception {
|
||||
if (!ctx.channel().isActive()) {
|
||||
throw CancelDecoderException.generate(null);
|
||||
}
|
||||
|
||||
if (!info.checkIncomingPacket()) throw CancelDecoderException.generate(null);
|
||||
if (!info.shouldTransformPacket()) {
|
||||
out.add(bytebuf.retain());
|
||||
|
@ -39,6 +39,10 @@ public class BungeeEncodeHandler extends MessageToMessageEncoder<ByteBuf> {
|
||||
|
||||
@Override
|
||||
protected void encode(final ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> out) throws Exception {
|
||||
if (!ctx.channel().isActive()) {
|
||||
throw CancelEncoderException.generate(null);
|
||||
}
|
||||
|
||||
if (!info.checkOutgoingPacket()) throw CancelEncoderException.generate(null);
|
||||
if (!info.shouldTransformPacket()) {
|
||||
out.add(bytebuf.retain());
|
||||
|
Loading…
Reference in New Issue
Block a user