mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-15 20:51:34 +01:00
Do not flush if channel is closed
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
87819ba806
commit
ae08ac2987
@ -235,7 +235,7 @@ public class PlayerSocketConnection extends PlayerConnection {
|
|||||||
if (encrypted) { // Encryption support
|
if (encrypted) { // Encryption support
|
||||||
ByteBuffer output = PacketUtils.localBuffer();
|
ByteBuffer output = PacketUtils.localBuffer();
|
||||||
try {
|
try {
|
||||||
this.encryptCipher.update(buffer.slice(index,length), output);
|
this.encryptCipher.update(buffer.slice(index, length), output);
|
||||||
buffer = output.flip();
|
buffer = output.flip();
|
||||||
index = 0;
|
index = 0;
|
||||||
} catch (ShortBufferException e) {
|
} catch (ShortBufferException e) {
|
||||||
@ -280,6 +280,8 @@ public class PlayerSocketConnection extends PlayerConnection {
|
|||||||
@Override
|
@Override
|
||||||
public void flush() {
|
public void flush() {
|
||||||
try {
|
try {
|
||||||
|
if (!channel.isConnected())
|
||||||
|
throw new ClosedChannelException();
|
||||||
synchronized (bufferLock) {
|
synchronized (bufferLock) {
|
||||||
try {
|
try {
|
||||||
updateLocalBuffer();
|
updateLocalBuffer();
|
||||||
|
Loading…
Reference in New Issue
Block a user