Don't process inactive channel + skip remaining bytes

Dieser Commit ist enthalten in:
Moulberry 2023-11-09 02:07:59 +08:00
Ursprung 93c618a150
Commit 1140204157
2 geänderte Dateien mit 12 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -25,7 +25,7 @@ repositories {
} }
dependencies { dependencies {
paperweight.paperDevBundle("1.20.2-R0.1-20231010.011415-29") paperweight.paperDevBundle("1.20.2-R0.1-SNAPSHOT")
implementation("xyz.jpenilla:reflection-remapper:0.1.0-SNAPSHOT") implementation("xyz.jpenilla:reflection-remapper:0.1.0-SNAPSHOT")
// Zstd Compression Library // Zstd Compression Library

Datei anzeigen

@ -26,6 +26,12 @@ public class AxiomBigPayloadHandler extends ByteToMessageDecoder {
@Override @Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
// Don't process if channel isn't active
if (!ctx.channel().isActive()) {
in.skipBytes(in.readableBytes());
return;
}
int i = in.readableBytes(); int i = in.readableBytes();
if (i != 0) { if (i != 0) {
int readerIndex = in.readerIndex(); int readerIndex = in.readerIndex();
@ -55,6 +61,11 @@ public class AxiomBigPayloadHandler extends ByteToMessageDecoder {
} }
ctx.fireChannelRead(in.retain()); ctx.fireChannelRead(in.retain());
// Skip remaining bytes
if (in.readableBytes() > 0) {
in.skipBytes(in.readableBytes());
}
} }
@Override @Override