1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Simplified and fixed server restart procedure:

- Replaced several assertions with runtime_error's to detect them in
release builds
- Removed multiple dispatchMainThread calls in server shutdown code to
simplify debugging and code flow
- Moved handling of gameplay shutdown and score calculation from
PlayerInterface to ServerHandler (not perfect, but better than before)
This commit is contained in:
Ivan Savenko
2024-04-07 14:19:57 +03:00
parent 0a80c6c27b
commit 80acd7e77c
6 changed files with 119 additions and 102 deletions

View File

@ -171,7 +171,11 @@ void CVCMIServer::onPacketReceived(const std::shared_ptr<INetworkConnection> & c
void CVCMIServer::setState(EServerState value)
{
assert(state != EServerState::SHUTDOWN); // do not attempt to restart dying server
if (value == EServerState::SHUTDOWN && state == EServerState::SHUTDOWN)
logGlobal->warn("Attempt to shutdown already shutdown server!");
// do not attempt to restart dying server
assert(state != EServerState::SHUTDOWN || state == value);
state = value;
if (state == EServerState::SHUTDOWN)