- added more socket threaded protection and output curl version if ftp transfers fail

This commit is contained in:
Mark Vejvoda
2011-01-01 10:16:25 +00:00
parent 8e42035257
commit 48ab8b7b32
5 changed files with 36 additions and 11 deletions

View File

@@ -409,6 +409,27 @@ vector<string> Config::getPathListForType(PathType type, string scenarioDir) {
if(isdir(userData.c_str()) == false) {
createDirectoryPaths(userData);
}
string userDataMaps = userData + GameConstants::folder_path_maps;
if(isdir(userDataMaps.c_str()) == false) {
createDirectoryPaths(userDataMaps);
}
string userDataScenarios = userData + GameConstants::folder_path_scenarios;
if(isdir(userDataScenarios.c_str()) == false) {
createDirectoryPaths(userDataScenarios);
}
string userDataTechs = userData + GameConstants::folder_path_techs;
if(isdir(userDataTechs.c_str()) == false) {
createDirectoryPaths(userDataTechs);
}
string userDataTilesets = userData + GameConstants::folder_path_tilesets;
if(isdir(userDataTilesets.c_str()) == false) {
createDirectoryPaths(userDataTilesets);
}
string userDataTutorials = userData + GameConstants::folder_path_tutorials;
if(isdir(userDataTutorials.c_str()) == false) {
createDirectoryPaths(userDataTutorials);
}
}
if(scenarioDir != "") {
pathList.push_back(data_path+scenarioDir);

View File

@@ -1011,7 +1011,8 @@ int glestMain(int argc, char** argv) {
if( (hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_VERSION]) == true ||
hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_SDL_INFO]) == true ||
hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_LUA_INFO]) == true) &&
hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_LUA_INFO]) == true ||
hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_CURL_INFO]) == true) &&
hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_OPENGL_INFO]) == false &&
hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_VALIDATE_TECHTREES]) == false &&
hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_VALIDATE_FACTIONS]) == false) {

View File

@@ -1691,8 +1691,10 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client
clientInterface->sendTextMessage(szMsg,-1, true);
}
else {
curl_version_info_data *curlVersion= curl_version_info(CURLVERSION_NOW);
char szMsg[1024]="";
sprintf(szMsg,"Player: %s FAILED to download the map: %s",getHumanPlayerName().c_str(),gameSettings->getMap().c_str());
sprintf(szMsg,"Player: %s FAILED to download the map: [%s] using CURL version [%s]",getHumanPlayerName().c_str(),gameSettings->getMap().c_str(),curlVersion->version);
clientInterface->sendTextMessage(szMsg,-1, true);
}
}
@@ -1712,8 +1714,11 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client
findDirs(Config::getInstance().getPathListForType(ptTilesets), tileSets);
}
else {
curl_version_info_data *curlVersion= curl_version_info(CURLVERSION_NOW);
char szMsg[1024]="";
sprintf(szMsg,"Player: %s FAILED to download the tileset: %s",getHumanPlayerName().c_str(),gameSettings->getTileset().c_str());
sprintf(szMsg,"Player: %s FAILED to download the tileset: [%s] using CURL version [%s]",getHumanPlayerName().c_str(),gameSettings->getTileset().c_str(),curlVersion->version);
clientInterface->sendTextMessage(szMsg,-1, true);
}
}

View File

@@ -142,9 +142,6 @@ void ClientInterface::update() {
string sMsg = "may go out of synch: client requestedCommands.size() = " + intToStr(requestedCommands.size());
sendTextMessage(sMsg,-1, true);
}
//clear chat variables
//!!!clearChatInfo();
}
std::string ClientInterface::getServerIpAddress() {
@@ -153,10 +150,6 @@ std::string ClientInterface::getServerIpAddress() {
void ClientInterface::updateLobby() {
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//clear chat variables
//!!!clearChatInfo();
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
NetworkMessageType networkMessageType = getNextMessageType(true);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
switch(networkMessageType)

View File

@@ -345,11 +345,16 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
bool checkForNewClients = true;
// Safety check since we can experience a disconnect and the slot is NULL
MutexSafeWrapper safeMutexSlot(&slotAccessorMutexes[event->triggerId],intToStr(__LINE__) + "_" + intToStr(event->triggerId));
ConnectionSlot *connectionSlot = NULL;
MutexSafeWrapper safeMutexSlot(NULL);
if(event->triggerId >= 0 && event->triggerId < GameConstants::maxPlayers) {
safeMutexSlot.setMutex(&slotAccessorMutexes[event->triggerId],intToStr(__LINE__) + "_" + intToStr(event->triggerId));
connectionSlot = slots[event->triggerId];
}
else {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR CONDITION, event->triggerId = %d\n",__FILE__,__FUNCTION__,__LINE__,event->triggerId);
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] ERROR CONDITION, event->triggerId = %d\n",__FILE__,__FUNCTION__,__LINE__,event->triggerId);
}
if(connectionSlot != NULL &&
(gameHasBeenInitiated == false ||