mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 18:15:39 +01:00
draft -> buf
This commit is contained in:
parent
2d33447fc1
commit
000a034836
@ -53,7 +53,7 @@ public class VelocityDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean handleCompressionOrder(ChannelHandlerContext ctx, ByteBuf draft) throws InvocationTargetException {
|
private boolean handleCompressionOrder(ChannelHandlerContext ctx, ByteBuf buf) throws InvocationTargetException {
|
||||||
if (handledCompression) return false;
|
if (handledCompression) return false;
|
||||||
|
|
||||||
int decoderIndex = ctx.pipeline().names().indexOf("compression-decoder");
|
int decoderIndex = ctx.pipeline().names().indexOf("compression-decoder");
|
||||||
@ -61,9 +61,9 @@ public class VelocityDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
|
|||||||
handledCompression = true;
|
handledCompression = true;
|
||||||
if (decoderIndex > ctx.pipeline().names().indexOf("via-decoder")) {
|
if (decoderIndex > ctx.pipeline().names().indexOf("via-decoder")) {
|
||||||
// Need to decompress this packet due to bad order
|
// Need to decompress this packet due to bad order
|
||||||
ByteBuf decompressed = (ByteBuf) PipelineUtil.callDecode((MessageToMessageDecoder<?>) ctx.pipeline().get("compression-decoder"), ctx, draft).get(0);
|
ByteBuf decompressed = (ByteBuf) PipelineUtil.callDecode((MessageToMessageDecoder<?>) ctx.pipeline().get("compression-decoder"), ctx, buf).get(0);
|
||||||
try {
|
try {
|
||||||
draft.clear().writeBytes(decompressed);
|
buf.clear().writeBytes(decompressed);
|
||||||
} finally {
|
} finally {
|
||||||
decompressed.release();
|
decompressed.release();
|
||||||
}
|
}
|
||||||
@ -78,11 +78,11 @@ public class VelocityDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void recompress(ChannelHandlerContext ctx, ByteBuf draft) throws Exception {
|
private void recompress(ChannelHandlerContext ctx, ByteBuf buf) throws Exception {
|
||||||
ByteBuf compressed = ctx.alloc().buffer();
|
ByteBuf compressed = ctx.alloc().buffer();
|
||||||
try {
|
try {
|
||||||
PipelineUtil.callEncode((MessageToByteEncoder<?>) ctx.pipeline().get("compression-encoder"), ctx, draft, compressed);
|
PipelineUtil.callEncode((MessageToByteEncoder<?>) ctx.pipeline().get("compression-encoder"), ctx, buf, compressed);
|
||||||
draft.clear().writeBytes(compressed);
|
buf.clear().writeBytes(compressed);
|
||||||
} finally {
|
} finally {
|
||||||
compressed.release();
|
compressed.release();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user