Improve efficiency of Java implementation of natives.

This commit is contained in:
Andrew Steinborn
2018-12-28 13:02:41 -05:00
parent 566a306d18
commit 9bbe25fc90
8 changed files with 74 additions and 25 deletions

View File

@@ -17,14 +17,7 @@ public class MinecraftCipherDecoder extends ByteToMessageDecoder {
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
ByteBuf decrypted = ctx.alloc().buffer(in.readableBytes());
try {
cipher.process(in, decrypted);
out.add(decrypted);
} catch (Exception e) {
decrypted.release();
throw e;
}
out.add(cipher.process(ctx, in));
}
@Override