Fix compression

This commit is contained in:
Andrew Steinborn
2018-07-25 12:20:20 -04:00
parent ee1cddc6a0
commit 2e250d24b6

View File

@@ -26,8 +26,9 @@ public class MinecraftCompressEncoder extends MessageToByteEncoder<ByteBuf> {
ByteBuf compressedBuffer = ctx.alloc().buffer(); ByteBuf compressedBuffer = ctx.alloc().buffer();
try { try {
int uncompressed = msg.readableBytes();
compressor.deflate(msg, compressedBuffer); compressor.deflate(msg, compressedBuffer);
ProtocolUtils.writeVarInt(out, msg.readableBytes()); ProtocolUtils.writeVarInt(out, uncompressed);
out.writeBytes(compressedBuffer); out.writeBytes(compressedBuffer);
} finally { } finally {
compressedBuffer.release(); compressedBuffer.release();