- bugfix for hideously aweful bug that made the lobby and lobby connection freeze for a long time
This commit is contained in:
parent
d21eeeae07
commit
83eaa67068
|
@ -64,6 +64,12 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
|||
getMissingTilesetFromFTPServerInProgress = false;
|
||||
getMissingTechtreeFromFTPServer = "";
|
||||
getMissingTechtreeFromFTPServerInProgress = false;
|
||||
lastCheckedCRCTilesetName = "";
|
||||
lastCheckedCRCTechtreeName = "";
|
||||
lastCheckedCRCMapName = "";
|
||||
lastCheckedCRCTilesetValue = -1;
|
||||
lastCheckedCRCTechtreeValue = -1;
|
||||
lastCheckedCRCMapValue = -1;
|
||||
|
||||
currentFactionLogo = "";
|
||||
factionTexture=NULL;
|
||||
|
@ -971,24 +977,48 @@ void MenuStateConnectedGame::update() {
|
|||
|
||||
label = label + ", " + clientInterface->getVersionString();
|
||||
|
||||
if(clientInterface->getAllowGameDataSynchCheck() == false) {
|
||||
Config &config = Config::getInstance();
|
||||
MutexSafeWrapper safeMutexFTPProgress(ftpClientThread != NULL ? ftpClientThread->getProgressMutex() : NULL,string(__FILE__) + "_" + intToStr(__LINE__));
|
||||
const GameSettings *gameSettings = clientInterface->getGameSettings();
|
||||
int32 tilesetCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTilesets,""), string("/") + gameSettings->getTileset() + string("/*"), ".xml", NULL);
|
||||
if(clientInterface->getAllowGameDataSynchCheck() == false &&
|
||||
gameSettings->getTileset() != "" &&
|
||||
gameSettings->getTech() != "" &&
|
||||
gameSettings->getMap() != "") {
|
||||
Config &config = Config::getInstance();
|
||||
|
||||
MutexSafeWrapper safeMutexFTPProgress(ftpClientThread != NULL ? ftpClientThread->getProgressMutex() : NULL,string(__FILE__) + "_" + intToStr(__LINE__));
|
||||
|
||||
int32 tilesetCRC = lastCheckedCRCTilesetValue;
|
||||
if(lastCheckedCRCTilesetName != gameSettings->getTileset()) {
|
||||
console.addLine("Checking tileset CRC " + gameSettings->getTileset() + "]");
|
||||
tilesetCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTilesets,""), string("/") + gameSettings->getTileset() + string("/*"), ".xml", NULL);
|
||||
// Test data synch
|
||||
//tilesetCRC++;
|
||||
lastCheckedCRCTilesetValue = tilesetCRC;
|
||||
lastCheckedCRCTilesetName = gameSettings->getTileset();
|
||||
}
|
||||
|
||||
int32 techCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), string("/") + gameSettings->getTech() + string("/*"), ".xml", NULL);
|
||||
int32 techCRC = lastCheckedCRCTechtreeValue;
|
||||
if(lastCheckedCRCTechtreeName != gameSettings->getTech()) {
|
||||
console.addLine("Checking techtree CRC " + gameSettings->getTech() + "]");
|
||||
techCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), string("/") + gameSettings->getTech() + string("/*"), ".xml", NULL);
|
||||
// Test data synch
|
||||
//techCRC++;
|
||||
lastCheckedCRCTechtreeValue = techCRC;
|
||||
lastCheckedCRCTechtreeName = gameSettings->getTech();
|
||||
}
|
||||
|
||||
int32 mapCRC = lastCheckedCRCMapValue;
|
||||
if(lastCheckedCRCMapName != gameSettings->getMap()) {
|
||||
Checksum checksum;
|
||||
string file = Map::getMapPath(gameSettings->getMap(),"",false);
|
||||
console.addLine("Checking map CRC " + file + "]");
|
||||
checksum.addFile(file);
|
||||
int32 mapCRC = checksum.getSum();
|
||||
mapCRC = checksum.getSum();
|
||||
// Test data synch
|
||||
//mapCRC++;
|
||||
|
||||
lastCheckedCRCMapValue = mapCRC;
|
||||
lastCheckedCRCMapName = gameSettings->getMap();
|
||||
}
|
||||
safeMutexFTPProgress.ReleaseLock();
|
||||
|
||||
bool dataSynchMismatch = ((mapCRC != 0 && mapCRC != gameSettings->getMapCRC()) ||
|
||||
|
@ -2025,6 +2055,7 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client
|
|||
|
||||
// Clear the CRC file Cache
|
||||
Checksum::clearFileCache();
|
||||
lastCheckedCRCMapValue = -1;
|
||||
|
||||
NetworkManager &networkManager= NetworkManager::getInstance();
|
||||
ClientInterface* clientInterface= networkManager.getClientInterface();
|
||||
|
@ -2090,7 +2121,7 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client
|
|||
|
||||
// Refresh CRC
|
||||
Config &config = Config::getInstance();
|
||||
int32 tilesetCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTilesets,""), string("/") + gameSettings->getTileset() + string("/*"), ".xml", NULL);
|
||||
lastCheckedCRCTilesetValue = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTilesets,""), string("/") + gameSettings->getTileset() + string("/*"), ".xml", NULL);
|
||||
|
||||
safeMutexFTPProgress.ReleaseLock();
|
||||
// END
|
||||
|
@ -2148,7 +2179,7 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client
|
|||
|
||||
// Refresh CRC
|
||||
Config &config = Config::getInstance();
|
||||
int32 techCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), string("/") + gameSettings->getTech() + string("/*"), ".xml", NULL);
|
||||
lastCheckedCRCTechtreeValue = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), string("/") + gameSettings->getTech() + string("/*"), ".xml", NULL);
|
||||
|
||||
safeMutexFTPProgress.ReleaseLock();
|
||||
// END
|
||||
|
|
|
@ -158,6 +158,13 @@ private:
|
|||
string getMissingTechtreeFromFTPServer;
|
||||
bool getMissingTechtreeFromFTPServerInProgress;
|
||||
|
||||
string lastCheckedCRCTilesetName;
|
||||
string lastCheckedCRCTechtreeName;
|
||||
string lastCheckedCRCMapName;
|
||||
int32 lastCheckedCRCTilesetValue;
|
||||
int32 lastCheckedCRCTechtreeValue;
|
||||
int32 lastCheckedCRCMapValue;
|
||||
|
||||
std::map<string,pair<int,string> > fileFTPProgressList;
|
||||
|
||||
public:
|
||||
|
|
|
@ -65,6 +65,13 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
|||
needToPublishDelayed=false;
|
||||
mapPublishingDelayTimer=time(NULL);
|
||||
|
||||
lastCheckedCRCTilesetName = "";
|
||||
lastCheckedCRCTechtreeName = "";
|
||||
lastCheckedCRCMapName = "";
|
||||
lastCheckedCRCTilesetValue = -1;
|
||||
lastCheckedCRCTechtreeValue = -1;
|
||||
lastCheckedCRCMapValue = -1;
|
||||
|
||||
publishToMasterserverThread = NULL;
|
||||
Lang &lang= Lang::getInstance();
|
||||
NetworkManager &networkManager= NetworkManager::getInstance();
|
||||
|
@ -2221,19 +2228,37 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings) {
|
|||
gameSettings->setNetworkFramePeriod(config.getInt("NetworkSendFrameCount","20"));
|
||||
gameSettings->setNetworkPauseGameForLaggedClients(((listBoxNetworkPauseGameForLaggedClients.getSelectedItemIndex() != 0)));
|
||||
|
||||
int32 tilesetCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTilesets,""), string("/") + gameSettings->getTileset() + string("/*"), ".xml", NULL);
|
||||
gameSettings->setTilesetCRC(tilesetCRC);
|
||||
|
||||
if(config.getBool("DisableServerLobbyTechtreeCRCCheck","false") == false) {
|
||||
int32 techCRC = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), "/" + gameSettings->getTech() + "/*", ".xml", NULL);
|
||||
gameSettings->setTechCRC(techCRC);
|
||||
if( gameSettings->getTileset() != "") {
|
||||
if(lastCheckedCRCTilesetName != gameSettings->getTileset()) {
|
||||
console.addLine("Checking tileset CRC " + gameSettings->getTileset() + "]");
|
||||
lastCheckedCRCTilesetValue = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTilesets,""), string("/") + gameSettings->getTileset() + string("/*"), ".xml", NULL);
|
||||
lastCheckedCRCTilesetName = gameSettings->getTileset();
|
||||
}
|
||||
gameSettings->setTilesetCRC(lastCheckedCRCTilesetValue);
|
||||
}
|
||||
|
||||
if(config.getBool("DisableServerLobbyTechtreeCRCCheck","false") == false) {
|
||||
if(gameSettings->getTech() != "") {
|
||||
if(lastCheckedCRCTechtreeName != gameSettings->getTech()) {
|
||||
console.addLine("Checking techtree CRC " + gameSettings->getTech() + "]");
|
||||
lastCheckedCRCTechtreeValue = getFolderTreeContentsCheckSumRecursively(config.getPathListForType(ptTechs,""), "/" + gameSettings->getTech() + "/*", ".xml", NULL);
|
||||
lastCheckedCRCTechtreeName = gameSettings->getTech();
|
||||
}
|
||||
gameSettings->setTechCRC(lastCheckedCRCTechtreeValue);
|
||||
}
|
||||
}
|
||||
|
||||
if(gameSettings->getMap() != "") {
|
||||
if(lastCheckedCRCMapName != gameSettings->getMap()) {
|
||||
Checksum checksum;
|
||||
string file = Map::getMapPath(gameSettings->getMap(),"",false);
|
||||
console.addLine("Checking map CRC " + file + "]");
|
||||
checksum.addFile(file);
|
||||
int32 mapCRC = checksum.getSum();
|
||||
gameSettings->setMapCRC(mapCRC);
|
||||
lastCheckedCRCMapValue = checksum.getSum();
|
||||
lastCheckedCRCMapName = gameSettings->getMap();
|
||||
}
|
||||
gameSettings->setMapCRC(lastCheckedCRCMapValue);
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
|
|
@ -148,6 +148,13 @@ private:
|
|||
float rMultiplierOffset;
|
||||
bool hasCheckedForUPNP;
|
||||
|
||||
string lastCheckedCRCTilesetName;
|
||||
string lastCheckedCRCTechtreeName;
|
||||
string lastCheckedCRCMapName;
|
||||
int32 lastCheckedCRCTilesetValue;
|
||||
int32 lastCheckedCRCTechtreeValue;
|
||||
int32 lastCheckedCRCMapValue;
|
||||
|
||||
public:
|
||||
MenuStateCustomGame(Program *program, MainMenu *mainMenu ,bool openNetworkSlots= false, bool parentMenuIsMasterserver=false, bool autostart=false);
|
||||
virtual ~MenuStateCustomGame();
|
||||
|
|
|
@ -557,10 +557,11 @@ void MenuStateJoinGame::connectToServer() {
|
|||
for(time_t elapsedWait = time(NULL);
|
||||
clientInterface->getIntroDone() == false &&
|
||||
clientInterface->isConnected() &&
|
||||
difftime(time(NULL),elapsedWait) <= 3;) {
|
||||
difftime(time(NULL),elapsedWait) <= 5;) {
|
||||
if(clientInterface->isConnected()) {
|
||||
//update lobby
|
||||
clientInterface->updateLobby();
|
||||
sleep(0);
|
||||
}
|
||||
}
|
||||
if( clientInterface->isConnected() == true &&
|
||||
|
|
|
@ -575,6 +575,7 @@ void clearFolderTreeContentsCheckSum(vector<string> paths, string pathSearchStri
|
|||
//finds all filenames like path and gets their checksum of all files combined
|
||||
int32 getFolderTreeContentsCheckSumRecursively(vector<string> paths, string pathSearchString, const string filterFileExt, Checksum *recursiveChecksum) {
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\n-------------- In [%s::%s Line: %d] Calculating CRC for [%s] -----------\n",__FILE__,__FUNCTION__,__LINE__,pathSearchString.c_str());
|
||||
|
||||
std::pair<string,string> cacheKeys = getFolderTreeContentsCheckSumCacheKey(paths, pathSearchString, filterFileExt);
|
||||
string cacheLookupId = cacheKeys.first;
|
||||
|
|
Loading…
Reference in New Issue