mirror of
https://github.com/glest/glest-source.git
synced 2025-08-22 07:52:51 +02:00
- added some ftp logging to network debug log
This commit is contained in:
@@ -631,6 +631,9 @@ void MenuStateConnectedGame::render() {
|
|||||||
if(mainMessageBox.getEnabled()) {
|
if(mainMessageBox.getEnabled()) {
|
||||||
renderer.renderMessageBox(&mainMessageBox);
|
renderer.renderMessageBox(&mainMessageBox);
|
||||||
}
|
}
|
||||||
|
if(ftpMessageBox.getEnabled()) {
|
||||||
|
renderer.renderMessageBox(&ftpMessageBox);
|
||||||
|
}
|
||||||
|
|
||||||
//if(ftpMessageBox.getEnabled()) {
|
//if(ftpMessageBox.getEnabled()) {
|
||||||
// renderer.renderMessageBox(&ftpMessageBox);
|
// renderer.renderMessageBox(&ftpMessageBox);
|
||||||
@@ -807,11 +810,6 @@ void MenuStateConnectedGame::render() {
|
|||||||
if(mainMessageBox.getEnabled()) {
|
if(mainMessageBox.getEnabled()) {
|
||||||
renderer.renderMessageBox(&mainMessageBox);
|
renderer.renderMessageBox(&mainMessageBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ftpMessageBox.getEnabled()) {
|
|
||||||
renderer.renderMessageBox(&ftpMessageBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(const std::exception &ex) {
|
catch(const std::exception &ex) {
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
|
@@ -1393,10 +1393,10 @@ void MenuStateCustomGame::update() {
|
|||||||
if(masterServerErr) {
|
if(masterServerErr) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(EndsWith(masterServererErrorToShow, "wrong router setup") == true)
|
if(EndsWith(masterServererErrorToShow, "wrong router setup") == true) {
|
||||||
{
|
|
||||||
masterServererErrorToShow=lang.get("WrongRouterSetup");
|
masterServererErrorToShow=lang.get("WrongRouterSetup");
|
||||||
}
|
}
|
||||||
|
masterServererErrorToShow += " (disabling publish)";
|
||||||
showMasterserverError=false;
|
showMasterserverError=false;
|
||||||
mainMessageBoxState=1;
|
mainMessageBoxState=1;
|
||||||
showMessageBox( masterServererErrorToShow, lang.get("ErrorFromMasterserver"), false);
|
showMessageBox( masterServererErrorToShow, lang.get("ErrorFromMasterserver"), false);
|
||||||
|
@@ -59,17 +59,21 @@ static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client thread CANCELLED, deleting file for writing [%s]\n",fullFilePath.c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client thread CANCELLED, deleting file for writing [%s]\n",fullFilePath.c_str());
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client thread CANCELLED, deleting file for writing [%s]\n",fullFilePath.c_str());
|
||||||
|
|
||||||
unlink(fullFilePath.c_str());
|
unlink(fullFilePath.c_str());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(out && out->stream == NULL) {
|
if(out && out->stream == NULL) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client thread opening file for writing [%s]\n",fullFilePath.c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client thread opening file for writing [%s]\n",fullFilePath.c_str());
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client thread opening file for writing [%s]\n",fullFilePath.c_str());
|
||||||
|
|
||||||
/* open file for writing */
|
/* open file for writing */
|
||||||
out->stream = fopen(fullFilePath.c_str(), "wb");
|
out->stream = fopen(fullFilePath.c_str(), "wb");
|
||||||
if(out->stream == NULL) {
|
if(out->stream == NULL) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client thread FAILED to open file for writing [%s]\n",fullFilePath.c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client thread FAILED to open file for writing [%s]\n",fullFilePath.c_str());
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client thread FAILED to open file for writing [%s]\n",fullFilePath.c_str());
|
||||||
return -1; /* failure, can't open file to write */
|
return -1; /* failure, can't open file to write */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,25 +93,31 @@ static long file_is_comming(struct curl_fileinfo *finfo,void *data,int remains)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\n===> FTP Client thread file_is_comming: remains: [%3d] filename: [%s] size: [%10luB] ", remains, finfo->filename,(unsigned long)finfo->size);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\n===> FTP Client thread file_is_comming: remains: [%3d] filename: [%s] size: [%10luB] ", remains, finfo->filename,(unsigned long)finfo->size);
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client thread file_is_comming: remains: [%3d] filename: [%s] size: [%10luB] ", remains, finfo->filename,(unsigned long)finfo->size);
|
||||||
|
|
||||||
if(out != NULL) {
|
if(out != NULL) {
|
||||||
//out->currentFilename = finfo->filename;
|
//out->currentFilename = finfo->filename;
|
||||||
out->currentFilename = fullFilePath;
|
out->currentFilename = fullFilePath;
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf(" current filename: [%s] ", fullFilePath.c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf(" current filename: [%s] ", fullFilePath.c_str());
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"current filename: [%s] ", fullFilePath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(finfo->filetype) {
|
switch(finfo->filetype) {
|
||||||
case CURLFILETYPE_DIRECTORY:
|
case CURLFILETYPE_DIRECTORY:
|
||||||
printf("DIR (creating [%s%s])\n",rootFilePath.c_str(),finfo->filename);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf(" DIR (creating [%s%s])\n",rootFilePath.c_str(),finfo->filename);
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork," DIR (creating [%s%s])\n",rootFilePath.c_str(),finfo->filename);
|
||||||
|
|
||||||
rootFilePath += finfo->filename;
|
rootFilePath += finfo->filename;
|
||||||
createDirectoryPaths(rootFilePath.c_str());
|
createDirectoryPaths(rootFilePath.c_str());
|
||||||
break;
|
break;
|
||||||
case CURLFILETYPE_FILE:
|
case CURLFILETYPE_FILE:
|
||||||
printf("FILE ");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf(" FILE ");
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork," FILE ");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("OTHER\n");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf(" OTHER\n");
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork," OTHER\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +129,7 @@ static long file_is_comming(struct curl_fileinfo *finfo,void *data,int remains)
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf(" opening file [%s] ", fullFilePath.c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf(" opening file [%s] ", fullFilePath.c_str());
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork," opening file [%s] ", fullFilePath.c_str());
|
||||||
|
|
||||||
out->stream = fopen(fullFilePath.c_str(), "wb");
|
out->stream = fopen(fullFilePath.c_str(), "wb");
|
||||||
if(out->stream == NULL) {
|
if(out->stream == NULL) {
|
||||||
@@ -133,6 +144,7 @@ static long file_is_downloaded(void *data) {
|
|||||||
struct FtpFile *out=(struct FtpFile *)data;
|
struct FtpFile *out=(struct FtpFile *)data;
|
||||||
if(out->stream) {
|
if(out->stream) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("DOWNLOAD COMPLETE!\n");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("DOWNLOAD COMPLETE!\n");
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"DOWNLOAD COMPLETE!\n");
|
||||||
|
|
||||||
fclose(out->stream);
|
fclose(out->stream);
|
||||||
out->stream = NULL;
|
out->stream = NULL;
|
||||||
@@ -142,6 +154,7 @@ static long file_is_downloaded(void *data) {
|
|||||||
|
|
||||||
int file_progress(struct FtpFile *out,double download_total, double download_now, double upload_total,double upload_now) {
|
int file_progress(struct FtpFile *out,double download_total, double download_now, double upload_total,double upload_now) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf(" download progress [%f][%f][%f][%f] ",download_total,download_now,upload_total,upload_now);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf(" download progress [%f][%f][%f][%f] ",download_total,download_now,upload_total,upload_now);
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork," download progress [%f][%f][%f][%f] ",download_total,download_now,upload_total,upload_now);
|
||||||
|
|
||||||
if(out != NULL &&
|
if(out != NULL &&
|
||||||
out->ftpServer != NULL &&
|
out->ftpServer != NULL &&
|
||||||
@@ -169,12 +182,14 @@ FTPClientThread::FTPClientThread(int portNumber, string serverUrl, std::pair<str
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FTPClientThread::signalQuit() {
|
void FTPClientThread::signalQuit() {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client: signalQuit\n");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("===> FTP Client: signalQuit\n");
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client: signalQuit\n");
|
||||||
BaseThread::signalQuit();
|
BaseThread::signalQuit();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FTPClientThread::shutdownAndWait() {
|
bool FTPClientThread::shutdownAndWait() {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client: shutdownAndWait\n");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("===> FTP Client: shutdownAndWait\n");
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client: shutdownAndWait\n");
|
||||||
|
|
||||||
signalQuit();
|
signalQuit();
|
||||||
return BaseThread::shutdownAndWait();
|
return BaseThread::shutdownAndWait();
|
||||||
@@ -197,7 +212,8 @@ FTP_Client_ResultType FTPClientThread::getMapFromServer(string mapFileName, stri
|
|||||||
destFile += destFileExt;
|
destFile += destFileExt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client thread about to try to RETR into [%s]\n",destFile.c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("===> FTP Client thread about to try to RETR into [%s]\n",destFile.c_str());
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client thread about to try to RETR into [%s]\n",destFile.c_str());
|
||||||
|
|
||||||
struct FtpFile ftpfile = {
|
struct FtpFile ftpfile = {
|
||||||
NULL,
|
NULL,
|
||||||
@@ -229,6 +245,7 @@ FTP_Client_ResultType FTPClientThread::getMapFromServer(string mapFileName, stri
|
|||||||
if(CURLE_OK != res) {
|
if(CURLE_OK != res) {
|
||||||
// we failed
|
// we failed
|
||||||
printf("curl FAILED with: %d [%s]\n", res,curl_easy_strerror(res));
|
printf("curl FAILED with: %d [%s]\n", res,curl_easy_strerror(res));
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"curl FAILED with: %d [%s]\n", res,curl_easy_strerror(res));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = ftp_crt_SUCCESS;
|
result = ftp_crt_SUCCESS;
|
||||||
@@ -331,6 +348,7 @@ FTP_Client_ResultType FTPClientThread::getTilesetFromServer(string tileSetName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client thread about to try to RETR into [%s]\n",destFile.c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client thread about to try to RETR into [%s]\n",destFile.c_str());
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client thread about to try to RETR into [%s]\n",destFile.c_str());
|
||||||
|
|
||||||
struct FtpFile ftpfile = {
|
struct FtpFile ftpfile = {
|
||||||
tileSetName.c_str(),
|
tileSetName.c_str(),
|
||||||
@@ -384,6 +402,7 @@ FTP_Client_ResultType FTPClientThread::getTilesetFromServer(string tileSetName,
|
|||||||
if(CURLE_OK != res) {
|
if(CURLE_OK != res) {
|
||||||
// we failed
|
// we failed
|
||||||
printf("curl FAILED with: %d [%s]\n", res,curl_easy_strerror(res));
|
printf("curl FAILED with: %d [%s]\n", res,curl_easy_strerror(res));
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"curl FAILED with: %d [%s]\n", res,curl_easy_strerror(res));
|
||||||
|
|
||||||
if(destRootFolder != "") {
|
if(destRootFolder != "") {
|
||||||
//unlink(destRootFolder.c_str());
|
//unlink(destRootFolder.c_str());
|
||||||
@@ -468,10 +487,13 @@ void FTPClientThread::execute() {
|
|||||||
safeMutex2.ReleaseLock();
|
safeMutex2.ReleaseLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(25);
|
if(this->getQuitStatus() == false) {
|
||||||
|
sleep(25);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client exiting!\n");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("===> FTP Client exiting!\n");
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client exiting!\n");
|
||||||
}
|
}
|
||||||
catch(const exception &ex) {
|
catch(const exception &ex) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||||
|
@@ -32,7 +32,8 @@ FTPClientValidationInterface * FTPServerThread::ftpValidationIntf = NULL;
|
|||||||
ip_t FindExternalFTPServerIp(ip_t clientIp) {
|
ip_t FindExternalFTPServerIp(ip_t clientIp) {
|
||||||
ip_t result = clientToFTPServerList[clientIp];
|
ip_t result = clientToFTPServerList[clientIp];
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server thread clientIp = %u, result = %u\n",clientIp,result);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("===> FTP Server thread clientIp = %u, result = %u\n",clientIp,result);
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Server thread clientIp = %u, result = %u\n",clientIp,result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -66,11 +67,14 @@ FTPServerThread::~FTPServerThread() {
|
|||||||
|
|
||||||
void FTPServerThread::signalQuit() {
|
void FTPServerThread::signalQuit() {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server: signalQuit\n");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server: signalQuit\n");
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Server: signalQuit\n");
|
||||||
|
|
||||||
BaseThread::signalQuit();
|
BaseThread::signalQuit();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FTPServerThread::shutdownAndWait() {
|
bool FTPServerThread::shutdownAndWait() {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server: shutdownAndWait\n");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("===> FTP Server: shutdownAndWait\n");
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Server: shutdownAndWait\n");
|
||||||
|
|
||||||
signalQuit();
|
signalQuit();
|
||||||
bool ret = BaseThread::shutdownAndWait();
|
bool ret = BaseThread::shutdownAndWait();
|
||||||
@@ -80,7 +84,8 @@ bool FTPServerThread::shutdownAndWait() {
|
|||||||
|
|
||||||
void FTPServerThread::addClientToServerIPAddress(uint32 clientIp,uint32 ServerIp) {
|
void FTPServerThread::addClientToServerIPAddress(uint32 clientIp,uint32 ServerIp) {
|
||||||
clientToFTPServerList[clientIp] = ServerIp;
|
clientToFTPServerList[clientIp] = ServerIp;
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server thread clientIp = %u, ServerIp = %u\n",clientIp,ServerIp);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("===> FTP Server thread clientIp = %u, ServerIp = %u\n",clientIp,ServerIp);
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Server thread clientIp = %u, ServerIp = %u\n",clientIp,ServerIp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FTPServerThread::execute() {
|
void FTPServerThread::execute() {
|
||||||
@@ -128,14 +133,15 @@ void FTPServerThread::execute() {
|
|||||||
*/
|
*/
|
||||||
ftpStart(portNumber);
|
ftpStart(portNumber);
|
||||||
while(this->getQuitStatus() == false) {
|
while(this->getQuitStatus() == false) {
|
||||||
int processedWork = ftpExecute();
|
ftpExecute();
|
||||||
if(processedWork == 0) {
|
//if(processedWork == 0) {
|
||||||
//sleep(25);
|
//sleep(25);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
ftpShutdown();
|
ftpShutdown();
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server exiting!\n");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("===> FTP Server exiting!\n");
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Server exiting!\n");
|
||||||
}
|
}
|
||||||
catch(const exception &ex) {
|
catch(const exception &ex) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||||
|
Reference in New Issue
Block a user