mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-01 23:12:49 +02:00
Merged Ivan's changes from trunk (r1921)
This commit is contained in:
@@ -215,7 +215,9 @@ void CClient::endGame( bool closeConnection /*= true*/ )
|
||||
const_cast<CGameInfo*>(CGI)->state.dellNull();
|
||||
tlog0 << "Deleted mapHandler and gameState." << std::endl;
|
||||
|
||||
CPlayerInterface * oldInt = LOCPLINT;
|
||||
LOCPLINT = NULL;
|
||||
oldInt->pim->unlock();
|
||||
while (!playerint.empty())
|
||||
{
|
||||
CGameInterface *pint = playerint.begin()->second;
|
||||
@@ -520,20 +522,15 @@ void CClient::stopConnection()
|
||||
{
|
||||
terminate = true;
|
||||
|
||||
if (serv)
|
||||
if (serv) //request closing connection
|
||||
{
|
||||
tlog0 << "Connection has been requested to be closed.\n";
|
||||
boost::unique_lock<boost::mutex>(*serv->wmx);
|
||||
*serv << &CloseServer();
|
||||
tlog0 << "Sent closing signal to the server\n";
|
||||
|
||||
serv->close();
|
||||
delete serv;
|
||||
serv = NULL;
|
||||
tlog3 << "Our socket has been closed." << std::endl;
|
||||
}
|
||||
|
||||
if(connectionHandler)
|
||||
if(connectionHandler)//end connection handler
|
||||
{
|
||||
if(connectionHandler->get_id() != boost::this_thread::get_id())
|
||||
connectionHandler->join();
|
||||
@@ -543,6 +540,14 @@ void CClient::stopConnection()
|
||||
delete connectionHandler;
|
||||
connectionHandler = NULL;
|
||||
}
|
||||
|
||||
if (serv) //and delete connection
|
||||
{
|
||||
serv->close();
|
||||
delete serv;
|
||||
serv = NULL;
|
||||
tlog3 << "Our socket has been closed." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void CClient::battleStarted(const BattleInfo * info)
|
||||
|
||||
Reference in New Issue
Block a user