Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-25 15:50:19 +01:00
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.
Dieser Commit ist enthalten in:
Ursprung
b09331b79b
Commit
821a7a45bc
@ -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);
|
||||
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;
|
||||
} catch (Exception e) {
|
||||
out.release();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren