mirror of
https://github.com/glest/glest-source.git
synced 2025-08-19 14:41:23 +02:00
- attempt to fix thread crash when ending game for network play
This commit is contained in:
Submodule data/glest_game updated: b1c0f0cc18...19119ebb9c
@@ -770,16 +770,19 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
|
|||||||
MutexSafeWrapper safeMutex(server->getSlotMutex(playerIndex),CODE_AT_LINE);
|
MutexSafeWrapper safeMutex(server->getSlotMutex(playerIndex),CODE_AT_LINE);
|
||||||
ConnectionSlot *slot = server->getSlot(playerIndex,false);
|
ConnectionSlot *slot = server->getSlot(playerIndex,false);
|
||||||
if(slot != NULL) {
|
if(slot != NULL) {
|
||||||
safeMutex.ReleaseLock(true);
|
safeMutex.ReleaseLock();
|
||||||
NetworkMessageQuit networkMessageQuit;
|
NetworkMessageQuit networkMessageQuit;
|
||||||
slot->sendMessage(&networkMessageQuit);
|
slot->sendMessage(&networkMessageQuit);
|
||||||
sleep(5);
|
sleep(5);
|
||||||
|
|
||||||
//printf("Sending nctDisconnectNetworkPlayer\n");
|
//printf("Sending nctDisconnectNetworkPlayer\n");
|
||||||
safeMutex.Lock();
|
if(server != NULL) {
|
||||||
slot = server->getSlot(playerIndex,false);
|
MutexSafeWrapper safeMutex2(server->getSlotMutex(playerIndex),CODE_AT_LINE);
|
||||||
if(slot != NULL) {
|
slot = server->getSlot(playerIndex,false);
|
||||||
slot->close();
|
if(slot != NULL) {
|
||||||
|
safeMutex2.ReleaseLock();
|
||||||
|
slot->close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -340,6 +340,7 @@ void Game::endGame() {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
quitGame();
|
quitGame();
|
||||||
|
sleep(0);
|
||||||
|
|
||||||
Object::setStateCallback(NULL);
|
Object::setStateCallback(NULL);
|
||||||
thisGamePtr = NULL;
|
thisGamePtr = NULL;
|
||||||
|
@@ -250,6 +250,11 @@ void ConnectionSlotThread::execute() {
|
|||||||
//bool socketHasReadData = Socket::hasDataToRead(socket->getSocketId());
|
//bool socketHasReadData = Socket::hasDataToRead(socket->getSocketId());
|
||||||
bool socketHasReadData = Socket::hasDataToReadWithWait(socketId,150000);
|
bool socketHasReadData = Socket::hasDataToReadWithWait(socketId,150000);
|
||||||
|
|
||||||
|
if(getQuitStatus() == true) {
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ConnectionSlotEvent eventCopy;
|
ConnectionSlotEvent eventCopy;
|
||||||
eventCopy.eventType = eReceiveSocketData;
|
eventCopy.eventType = eReceiveSocketData;
|
||||||
eventCopy.connectionSlot = this->slotInterface->getSlot(slotIndex,true);
|
eventCopy.connectionSlot = this->slotInterface->getSlot(slotIndex,true);
|
||||||
|
@@ -2637,7 +2637,7 @@ int UPNP_Tools::upnp_init(void *param) {
|
|||||||
//if(devlist != NULL) {
|
//if(devlist != NULL) {
|
||||||
// freeUPNPDevlist(devlist);
|
// freeUPNPDevlist(devlist);
|
||||||
//}
|
//}
|
||||||
devlist = NULL;
|
//devlist = NULL;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user