mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 16:37:38 +01:00
Improve socket shutdown
This commit is contained in:
parent
557d34c378
commit
8895e49a52
@ -65,6 +65,7 @@ public class Server {
|
||||
|
||||
public void stop() {
|
||||
this.stop = true;
|
||||
this.workers.forEach(worker -> worker.selector.wakeup());
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
|
@ -19,7 +19,7 @@ import java.util.zip.Inflater;
|
||||
|
||||
public class Worker {
|
||||
private final Map<SocketChannel, NettyPlayerConnection> connectionMap = new ConcurrentHashMap<>();
|
||||
private final Selector selector = Selector.open();
|
||||
protected final Selector selector = Selector.open();
|
||||
private final PacketProcessor packetProcessor;
|
||||
|
||||
public Worker(Server server, PacketProcessor packetProcessor) throws IOException {
|
||||
|
@ -101,8 +101,7 @@ public final class PacketUtils {
|
||||
continue;
|
||||
final PlayerConnection playerConnection = player.getPlayerConnection();
|
||||
if (playerConnection instanceof NettyPlayerConnection) {
|
||||
final NettyPlayerConnection nettyPlayerConnection = (NettyPlayerConnection) playerConnection;
|
||||
nettyPlayerConnection.write(framedPacket);
|
||||
((NettyPlayerConnection) playerConnection).write(framedPacket);
|
||||
} else {
|
||||
playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user