Small optimization for NativeVelocityCipher
Instead of going through the general process function, which does extra checks to ensure that its arguments are sane, move "closer" to the action by stripping down to the actual implementation.
This commit is contained in:
@@ -50,14 +50,16 @@ public class NativeVelocityCipher implements VelocityCipher {
|
||||
|
||||
@Override
|
||||
public ByteBuf process(ChannelHandlerContext ctx, ByteBuf source) throws ShortBufferException {
|
||||
ByteBuf out = ctx.alloc().directBuffer(source.readableBytes());
|
||||
try {
|
||||
process(source, out);
|
||||
return out;
|
||||
} catch (Exception e) {
|
||||
out.release();
|
||||
throw e;
|
||||
}
|
||||
ensureNotDisposed();
|
||||
|
||||
int len = source.readableBytes();
|
||||
ByteBuf out = ctx.alloc().directBuffer(len);
|
||||
|
||||
impl.process(this.ctx, source.memoryAddress() + source.readerIndex(), len,
|
||||
out.memoryAddress(), encrypt);
|
||||
source.skipBytes(len);
|
||||
out.writerIndex(len);
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user