mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-30 21:17:53 +01:00
Do not forget to put the buffer back in the pool queue
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
526108b896
commit
fd027ecfd7
@ -280,7 +280,8 @@ public class PlayerSocketConnection extends PlayerConnection {
|
||||
final Cipher cipher = encryptCipher;
|
||||
// Encrypt data first
|
||||
ByteBuffer cipherInput = localBuffer.asByteBuffer(0, localBuffer.writerOffset());
|
||||
ByteBuffer cipherOutput = getPooledBuffer().asByteBuffer(0, BUFFER_SIZE);
|
||||
BinaryBuffer pooled = getPooledBuffer();
|
||||
ByteBuffer cipherOutput = pooled.asByteBuffer(0, BUFFER_SIZE);
|
||||
try {
|
||||
cipher.update(cipherInput, cipherOutput);
|
||||
} catch (ShortBufferException e) {
|
||||
@ -288,6 +289,7 @@ public class PlayerSocketConnection extends PlayerConnection {
|
||||
}
|
||||
localBuffer.clear();
|
||||
localBuffer.write(cipherOutput.flip());
|
||||
POOLED_BUFFERS.add(new SoftReference<>(pooled));
|
||||
}
|
||||
|
||||
this.waitingBuffers.add(localBuffer);
|
||||
|
Loading…
Reference in New Issue
Block a user