mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Merge remote-tracking branch 'upstream/develop' into mp-disconnection
# Conflicts: # server/CVCMIServer.cpp
This commit is contained in:
@@ -171,7 +171,10 @@ void CVCMIServer::run()
|
||||
|
||||
startAsyncAccept();
|
||||
|
||||
#if !defined(VCMI_ANDROID) && !defined(VCMI_IOS)
|
||||
#if defined(VCMI_ANDROID)
|
||||
CAndroidVMHelper vmHelper;
|
||||
vmHelper.callStaticVoidMethod(CAndroidVMHelper::NATIVE_METHODS_DEFAULT_CLASS, "onServerReady");
|
||||
#elif !defined(VCMI_IOS)
|
||||
if(shm)
|
||||
{
|
||||
shm->sr->setToReadyAndNotify(port);
|
||||
@@ -362,11 +365,32 @@ void CVCMIServer::threadHandleClient(std::shared_ptr<CConnection> c)
|
||||
setThreadName("CVCMIServer::handleConnection");
|
||||
c->enterLobbyConnectionMode();
|
||||
|
||||
#ifndef _MSC_VER
|
||||
try
|
||||
{
|
||||
#endif
|
||||
while(c->connected)
|
||||
{
|
||||
CPack * pack = c->retrievePack();
|
||||
CPack * pack;
|
||||
|
||||
try
|
||||
{
|
||||
pack = c->retrievePack();
|
||||
}
|
||||
catch(boost::system::system_error & e)
|
||||
{
|
||||
logNetwork->error("Network error receiving a pack. Connection %s dies. What happened: %s", c->toString(), e.what());
|
||||
|
||||
if(state != EServerState::LOBBY)
|
||||
{
|
||||
hangingConnections.insert(c);
|
||||
connections.erase(c);
|
||||
//gh->handleClientDisconnection(c);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if(auto lobbyPack = dynamic_ptr_cast<CPackForLobby>(pack))
|
||||
{
|
||||
handleReceivedPack(std::unique_ptr<CPackForLobby>(lobbyPack));
|
||||
@@ -376,18 +400,8 @@ void CVCMIServer::threadHandleClient(std::shared_ptr<CConnection> c)
|
||||
gh->handleReceivedPack(serverPack);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(boost::system::system_error & e)
|
||||
{
|
||||
(void)e;
|
||||
if(state != EServerState::LOBBY)
|
||||
{
|
||||
hangingConnections.insert(c);
|
||||
connections.erase(c);
|
||||
//gh->handleClientDisconnection(c);
|
||||
}
|
||||
}
|
||||
/*
|
||||
#ifndef _MSC_VER
|
||||
}
|
||||
catch(const std::exception & e)
|
||||
{
|
||||
(void)e;
|
||||
@@ -399,7 +413,8 @@ void CVCMIServer::threadHandleClient(std::shared_ptr<CConnection> c)
|
||||
state = EServerState::SHUTDOWN;
|
||||
handleException();
|
||||
throw;
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
|
||||
boost::unique_lock<boost::recursive_mutex> queueLock(mx);
|
||||
// if(state != ENDING_AND_STARTING_GAME)
|
||||
@@ -1037,7 +1052,9 @@ int main(int argc, char * argv[])
|
||||
signal(SIGSEGV, handleLinuxSignal);
|
||||
#endif
|
||||
|
||||
#ifndef VCMI_IOS
|
||||
console = new CConsoleHandler();
|
||||
#endif
|
||||
CBasicLogConfigurator logConfig(VCMIDirs::get().userLogsPath() / "VCMI_Server_log.txt", console);
|
||||
logConfig.configureDefault();
|
||||
logGlobal->info(SERVER_NAME);
|
||||
@@ -1099,6 +1116,7 @@ int main(int argc, char * argv[])
|
||||
void CVCMIServer::create()
|
||||
{
|
||||
const char * foo[1] = {"android-server"};
|
||||
|
||||
main(1, const_cast<char **>(foo));
|
||||
}
|
||||
#elif defined(SINGLE_PROCESS_APP)
|
||||
|
||||
Reference in New Issue
Block a user