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:
@ -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)
|
||||
|
Reference in New Issue
Block a user