3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-10-03 08:41:05 +02:00

Cancel Bungee packet encoding when closed (#2448)

Dieser Commit ist enthalten in:
Juan Cruz Linsalata 2021-04-24 13:30:08 -03:00 committet von GitHub
Ursprung ad0842c107
Commit f18e2b3875
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 12 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -40,6 +40,10 @@ public class BungeeChannelInitializer extends ChannelInitializer<Channel> {
@Override @Override
protected void initChannel(Channel socketChannel) throws Exception { protected void initChannel(Channel socketChannel) throws Exception {
if (!socketChannel.isActive()) {
return;
}
UserConnection info = new UserConnection(socketChannel); UserConnection info = new UserConnection(socketChannel);
// init protocol // init protocol
new ProtocolPipeline(info); new ProtocolPipeline(info);

Datei anzeigen

@ -37,6 +37,10 @@ public class BungeeDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
@Override @Override
protected void decode(final ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> out) throws Exception { 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.checkIncomingPacket()) throw CancelDecoderException.generate(null);
if (!info.shouldTransformPacket()) { if (!info.shouldTransformPacket()) {
out.add(bytebuf.retain()); out.add(bytebuf.retain());

Datei anzeigen

@ -39,6 +39,10 @@ public class BungeeEncodeHandler extends MessageToMessageEncoder<ByteBuf> {
@Override @Override
protected void encode(final ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> out) throws Exception { 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.checkOutgoingPacket()) throw CancelEncoderException.generate(null);
if (!info.shouldTransformPacket()) { if (!info.shouldTransformPacket()) {
out.add(bytebuf.retain()); out.add(bytebuf.retain());