try to fix stopping when starting fails

This commit is contained in:
creeper123123321 2021-04-29 17:21:14 -03:00 committed by GitHub
parent 4dc07fe731
commit 6e9fe83bcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -188,6 +188,10 @@ private fun stopServer() {
Via.getManager().connectionManager.connections.forEach {
it.channel?.pipeline()?.get(MinecraftHandler::class.java)?.disconnect("Stopping")
}
(Via.getManager() as ViaManagerImpl).destroy()
} finally {
finishedFuture.complete(Unit)
ktorServer?.stop(1000, 1000)
httpClient.close()
listOf<Future<*>?>(
@ -196,10 +200,6 @@ private fun stopServer() {
childLoop.shutdownGracefully()
)
.forEach { it?.sync() }
(Via.getManager() as ViaManagerImpl).destroy()
} finally {
finishedFuture.complete(Unit)
}
}