mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-09 13:19:05 +01:00
Move OOM try-catch
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
afdc67fc26
commit
1851ea7eca
@ -276,7 +276,13 @@ public class PlayerSocketConnection extends PlayerConnection {
|
||||
public void flush() {
|
||||
try {
|
||||
synchronized (bufferLock) {
|
||||
updateLocalBuffer();
|
||||
try {
|
||||
updateLocalBuffer();
|
||||
} catch (OutOfMemoryError e) {
|
||||
this.waitingBuffers.clear();
|
||||
System.gc(); // Explicit gc forcing buffers to be collected
|
||||
throw new ClosedChannelException();
|
||||
}
|
||||
}
|
||||
synchronized (flushLock) {
|
||||
try {
|
||||
@ -291,10 +297,6 @@ public class PlayerSocketConnection extends PlayerConnection {
|
||||
} catch (IOException e) { // Couldn't write to the socket
|
||||
MinecraftServer.getExceptionManager().handleException(e);
|
||||
throw new ClosedChannelException();
|
||||
} catch (OutOfMemoryError e) { // Couldn't allocate a pooled buffer
|
||||
this.waitingBuffers.clear();
|
||||
System.gc(); // Explicit gc forcing buffers to be collected
|
||||
throw new ClosedChannelException();
|
||||
}
|
||||
}
|
||||
} catch (ClosedChannelException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user