mirror of https://github.com/Minestom/Minestom.git
Fix socket close
This commit is contained in:
parent
945bf6a914
commit
1fe93ce653
|
@ -88,7 +88,6 @@ public final class Server {
|
|||
}
|
||||
}
|
||||
try {
|
||||
serverSocket.close();
|
||||
if (socketAddress instanceof UnixDomainSocketAddress unixDomainSocketAddress) {
|
||||
Files.deleteIfExists(unixDomainSocketAddress.getPath());
|
||||
}
|
||||
|
@ -104,6 +103,11 @@ public final class Server {
|
|||
|
||||
public void stop() {
|
||||
this.stop = true;
|
||||
try {
|
||||
this.serverSocket.close();
|
||||
} catch (IOException e) {
|
||||
MinecraftServer.getExceptionManager().handleException(e);
|
||||
}
|
||||
this.selector.wakeup();
|
||||
this.workers.forEach(worker -> worker.selector.wakeup());
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class ServerProcessTest {
|
|||
@Test
|
||||
public void tick() {
|
||||
var process = MinecraftServer.updateProcess();
|
||||
process.start(new InetSocketAddress("localhost", 25567));
|
||||
process.start(new InetSocketAddress("localhost", 25565));
|
||||
var ticker = process.ticker();
|
||||
assertDoesNotThrow(() -> ticker.tick(System.currentTimeMillis()));
|
||||
assertDoesNotThrow(process::stop);
|
||||
|
|
Loading…
Reference in New Issue