From da9efdb765251492ec193a2fc0a629fbd25dc53f Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 10 May 2024 20:17:42 +0700 Subject: [PATCH] paranoia --- .../ru/dbotthepony/kstarbound/server/ServerConnection.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/server/ServerConnection.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/server/ServerConnection.kt index aff933e2..713b626b 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/server/ServerConnection.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/server/ServerConnection.kt @@ -525,9 +525,12 @@ class ServerConnection(val server: StarboundServer, type: ConnectionType) : Conn private val isDisconnecting = AtomicBoolean() private suspend fun disconnect0(reason: String) { - // initiate shipworld shutdown + // make server forget shipworld right away + // This should account for extremely unlikely case + // where client initiated disconnect, + // and reconnects before this function finishes running if (::shipWorld.isInitialized) { - shipWorld.eventLoop.shutdown() + server.notifyWorldUnloaded(shipWorld.worldID) } // stop being counted towards player count, vanish from connection list