mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-05 23:11:36 +01:00
chore: broaden closed channel handling
This commit is contained in:
parent
2065f63f82
commit
187931e50b
@ -13,6 +13,7 @@ import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.net.*;
|
||||
import java.nio.channels.AsynchronousCloseException;
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.nio.file.Files;
|
||||
@ -97,8 +98,8 @@ public final class Server {
|
||||
try {
|
||||
// Read & process packets
|
||||
connection.read(packetParser);
|
||||
} catch (AsynchronousCloseException ignored) {
|
||||
// We closed the socket during read, just exit.
|
||||
} catch (ClosedChannelException ignored) {
|
||||
break; // We closed the socket during read, just exit.
|
||||
} catch (EOFException e) {
|
||||
connection.disconnect();
|
||||
break;
|
||||
@ -115,8 +116,8 @@ public final class Server {
|
||||
while (!stop) {
|
||||
try {
|
||||
connection.flushSync();
|
||||
} catch (AsynchronousCloseException ignored) {
|
||||
// We closed the socket during write, just exit.
|
||||
} catch (ClosedChannelException ignored) {
|
||||
break; // We closed the socket during write, just exit.
|
||||
} catch (EOFException e) {
|
||||
connection.disconnect();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user