mirror of
https://github.com/glest/glest-source.git
synced 2025-08-20 07:01:21 +02:00
- added guards around CRC checking in client connected menu
This commit is contained in:
@@ -865,6 +865,7 @@ void MenuStateConnectedGame::update() {
|
|||||||
|
|
||||||
if(clientInterface->getAllowGameDataSynchCheck() == false) {
|
if(clientInterface->getAllowGameDataSynchCheck() == false) {
|
||||||
Config &config = Config::getInstance();
|
Config &config = Config::getInstance();
|
||||||
|
MutexSafeWrapper safeMutexFTPProgress(ftpClientThread != NULL ? ftpClientThread->getProgressMutex() : NULL);
|
||||||
const GameSettings *gameSettings = clientInterface->getGameSettings();
|
const GameSettings *gameSettings = clientInterface->getGameSettings();
|
||||||
int32 tilesetCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTilesets,""), string("/") + gameSettings->getTileset() + string("/*"), ".xml", NULL);
|
int32 tilesetCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTilesets,""), string("/") + gameSettings->getTileset() + string("/*"), ".xml", NULL);
|
||||||
// Test data synch
|
// Test data synch
|
||||||
@@ -875,6 +876,7 @@ void MenuStateConnectedGame::update() {
|
|||||||
string file = Map::getMapPath(gameSettings->getMap(),"",false);
|
string file = Map::getMapPath(gameSettings->getMap(),"",false);
|
||||||
checksum.addFile(file);
|
checksum.addFile(file);
|
||||||
int32 mapCRC = checksum.getSum();
|
int32 mapCRC = checksum.getSum();
|
||||||
|
safeMutexFTPProgress.ReleaseLock();
|
||||||
|
|
||||||
bool dataSynchMismatch = (mapCRC != gameSettings->getMapCRC() || tilesetCRC != gameSettings->getTilesetCRC());
|
bool dataSynchMismatch = (mapCRC != gameSettings->getMapCRC() || tilesetCRC != gameSettings->getTilesetCRC());
|
||||||
|
|
||||||
@@ -1845,7 +1847,7 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client
|
|||||||
|
|
||||||
MutexSafeWrapper safeMutexFTPProgress(ftpClientThread->getProgressMutex());
|
MutexSafeWrapper safeMutexFTPProgress(ftpClientThread->getProgressMutex());
|
||||||
fileFTPProgressList.erase(itemName);
|
fileFTPProgressList.erase(itemName);
|
||||||
safeMutexFTPProgress.ReleaseLock();
|
safeMutexFTPProgress.ReleaseLock(true);
|
||||||
|
|
||||||
NetworkManager &networkManager= NetworkManager::getInstance();
|
NetworkManager &networkManager= NetworkManager::getInstance();
|
||||||
ClientInterface* clientInterface= networkManager.getClientInterface();
|
ClientInterface* clientInterface= networkManager.getClientInterface();
|
||||||
@@ -1859,6 +1861,10 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client
|
|||||||
// START
|
// START
|
||||||
// Clear the CRC Cache if it is populated
|
// Clear the CRC Cache if it is populated
|
||||||
//
|
//
|
||||||
|
// Clear the CRC file Cache
|
||||||
|
safeMutexFTPProgress.Lock();
|
||||||
|
Checksum::clearFileCache();
|
||||||
|
|
||||||
vector<string> paths = Config::getInstance().getPathListForType(ptTilesets);
|
vector<string> paths = Config::getInstance().getPathListForType(ptTilesets);
|
||||||
string cacheLookupId = CacheManager::getFolderTreeContentsCheckSumRecursivelyCacheLookupKey1;
|
string cacheLookupId = CacheManager::getFolderTreeContentsCheckSumRecursivelyCacheLookupKey1;
|
||||||
std::map<string,int32> &crcTreeCache = CacheManager::getCachedItem< std::map<string,int32> >(cacheLookupId);
|
std::map<string,int32> &crcTreeCache = CacheManager::getCachedItem< std::map<string,int32> >(cacheLookupId);
|
||||||
@@ -1890,11 +1896,9 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client
|
|||||||
crcTreeCache2.erase(cacheKey);
|
crcTreeCache2.erase(cacheKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
safeMutexFTPProgress.ReleaseLock();
|
||||||
// END
|
// END
|
||||||
|
|
||||||
// Clear the CRC file Cache
|
|
||||||
Checksum::clearFileCache();
|
|
||||||
|
|
||||||
// Reload tilesets for the UI
|
// Reload tilesets for the UI
|
||||||
findDirs(Config::getInstance().getPathListForType(ptTilesets), tileSets);
|
findDirs(Config::getInstance().getPathListForType(ptTilesets), tileSets);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user