mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +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;
|
final Cipher cipher = encryptCipher;
|
||||||
// Encrypt data first
|
// Encrypt data first
|
||||||
ByteBuffer cipherInput = localBuffer.asByteBuffer(0, localBuffer.writerOffset());
|
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 {
|
try {
|
||||||
cipher.update(cipherInput, cipherOutput);
|
cipher.update(cipherInput, cipherOutput);
|
||||||
} catch (ShortBufferException e) {
|
} catch (ShortBufferException e) {
|
||||||
@ -288,6 +289,7 @@ public class PlayerSocketConnection extends PlayerConnection {
|
|||||||
}
|
}
|
||||||
localBuffer.clear();
|
localBuffer.clear();
|
||||||
localBuffer.write(cipherOutput.flip());
|
localBuffer.write(cipherOutput.flip());
|
||||||
|
POOLED_BUFFERS.add(new SoftReference<>(pooled));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.waitingBuffers.add(localBuffer);
|
this.waitingBuffers.add(localBuffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user