This commit is contained in:
creeper123123321 2021-05-15 05:26:36 -03:00 committed by GitHub
parent 9df02816f2
commit e76f7f7118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ class CompressionCodec(val threshold: Int) : MessageToMessageCodec<ByteBuf, Byte
override fun encode(ctx: ChannelHandlerContext, input: ByteBuf, out: MutableList<Any>) {
val frameLength = input.readableBytes()
val outBuf = ctx.alloc().buffer()
outBuf.skipBytes(5) // reserve varint
try {
if (frameLength < threshold) {
outBuf.writeByte(0)
@ -69,4 +69,4 @@ class CompressionCodec(val threshold: Int) : MessageToMessageCodec<ByteBuf, Byte
}
}
}
}