Attempt to fix server hanging on shutdown
This commit is contained in:
@@ -4,6 +4,7 @@ import core.game.ge.GrandExchangeDatabase;
|
||||
import core.game.interaction.object.dmc.DMCHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.info.login.PlayerParser;
|
||||
import rs09.Server;
|
||||
import rs09.ServerConstants;
|
||||
import rs09.game.ge.OfferManager;
|
||||
import rs09.game.system.SystemLogger;
|
||||
@@ -57,6 +58,7 @@ public final class SystemTermination {
|
||||
if (!file.isDirectory()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
Server.getReactor().terminate();
|
||||
for (Iterator<Player> it = Repository.getPlayers().iterator(); it.hasNext();) {
|
||||
try {
|
||||
Player p = it.next();
|
||||
|
||||
@@ -40,6 +40,7 @@ object Server {
|
||||
/**
|
||||
* The NIO reactor.
|
||||
*/
|
||||
@JvmStatic
|
||||
var reactor: NioReactor? = null
|
||||
|
||||
/**
|
||||
@@ -72,7 +73,8 @@ object Server {
|
||||
Runtime.getRuntime().addShutdownHook(ServerConstants.SHUTDOWN_HOOK)
|
||||
SystemLogger.logInfo("Starting networking...")
|
||||
try {
|
||||
NioReactor.configure(43594 + GameWorld.settings?.worldId!!).start()
|
||||
reactor = NioReactor.configure(43594 + GameWorld.settings?.worldId!!)
|
||||
reactor!!.start()
|
||||
} catch (e: BindException) {
|
||||
SystemLogger.logErr("Port " + (43594 + GameWorld.settings?.worldId!!) + " is already in use!")
|
||||
throw e
|
||||
|
||||
Reference in New Issue
Block a user