- attempt to fix thread crash when ending game for network play
This commit is contained in:
parent
1a3e265d4a
commit
4dea67cff9
|
@ -1 +1 @@
|
|||
Subproject commit b1c0f0cc18cdd2311b581b44e7ae161317438c93
|
||||
Subproject commit 19119ebb9c7c91d364c8d413194e476aa815000b
|
|
@ -770,21 +770,24 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
|
|||
MutexSafeWrapper safeMutex(server->getSlotMutex(playerIndex),CODE_AT_LINE);
|
||||
ConnectionSlot *slot = server->getSlot(playerIndex,false);
|
||||
if(slot != NULL) {
|
||||
safeMutex.ReleaseLock(true);
|
||||
safeMutex.ReleaseLock();
|
||||
NetworkMessageQuit networkMessageQuit;
|
||||
slot->sendMessage(&networkMessageQuit);
|
||||
sleep(5);
|
||||
|
||||
//printf("Sending nctDisconnectNetworkPlayer\n");
|
||||
safeMutex.Lock();
|
||||
if(server != NULL) {
|
||||
MutexSafeWrapper safeMutex2(server->getSlotMutex(playerIndex),CODE_AT_LINE);
|
||||
slot = server->getSlot(playerIndex,false);
|
||||
if(slot != NULL) {
|
||||
safeMutex2.ReleaseLock();
|
||||
slot->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] found nctDisconnectNetworkPlayer\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -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__);
|
||||
|
||||
quitGame();
|
||||
sleep(0);
|
||||
|
||||
Object::setStateCallback(NULL);
|
||||
thisGamePtr = NULL;
|
||||
|
|
|
@ -250,6 +250,11 @@ void ConnectionSlotThread::execute() {
|
|||
//bool socketHasReadData = Socket::hasDataToRead(socket->getSocketId());
|
||||
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;
|
||||
eventCopy.eventType = eReceiveSocketData;
|
||||
eventCopy.connectionSlot = this->slotInterface->getSlot(slotIndex,true);
|
||||
|
|
|
@ -2637,7 +2637,7 @@ int UPNP_Tools::upnp_init(void *param) {
|
|||
//if(devlist != NULL) {
|
||||
// freeUPNPDevlist(devlist);
|
||||
//}
|
||||
devlist = NULL;
|
||||
//devlist = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue