- added extra mutex guard when closing connection slots to try to fix parallel close connections from causing errors.

This commit is contained in:
Mark Vejvoda
2011-05-20 19:44:33 +00:00
parent 5d6ac3aa1d
commit af3c25850a
2 changed files with 7 additions and 0 deletions

View File

@@ -806,10 +806,15 @@ void ConnectionSlot::close() {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
MutexSafeWrapper safeMutex(&mutexCloseConnection,mutexOwnerId);
bool updateServerListener = (socket != NULL); bool updateServerListener = (socket != NULL);
delete socket; delete socket;
socket= NULL; socket= NULL;
safeMutex.ReleaseLock();
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s LINE: %d]\n",__FILE__,__FUNCTION__,__LINE__); if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s LINE: %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(updateServerListener == true && ready == false) { if(updateServerListener == true && ready == false) {

View File

@@ -112,6 +112,8 @@ private:
time_t connectedTime; time_t connectedTime;
bool gotIntro; bool gotIntro;
Mutex mutexCloseConnection;
Mutex mutexPendingNetworkCommandList; Mutex mutexPendingNetworkCommandList;
vector<NetworkCommand> vctPendingNetworkCommandList; vector<NetworkCommand> vctPendingNetworkCommandList;
ConnectionSlotThread* slotThreadWorker; ConnectionSlotThread* slotThreadWorker;