- added more debug info and error output to detect failures to write file data during file xfers

This commit is contained in:
Mark Vejvoda 2011-04-04 17:56:47 +00:00
parent f91c4a8707
commit 5fd59eb00f
1 changed files with 10 additions and 2 deletions

View File

@ -62,7 +62,7 @@ static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) {
fullFilePath += out->filename;
}
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client thread writing file [%s]\n",fullFilePath.c_str());
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client thread writing to file [%s]\n",fullFilePath.c_str());
// Abort file xfer and delete partial file
if(out && out->ftpServer && out->ftpServer->getQuitStatus() == true) {
@ -88,12 +88,20 @@ static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) {
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::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client thread FAILED to open file for writing [%s]\n",fullFilePath.c_str());
SystemFlags::OutputDebug(SystemFlags::debugError,"===> FTP Client thread FAILED to open file for writing [%s]\n",fullFilePath.c_str());
return -1; /* failure, can't open file to write */
}
out->isValidXfer = true;
}
return fwrite(buffer, size, nmemb, out->stream);
size_t result = fwrite(buffer, size, nmemb, out->stream);
if(result != nmemb) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("===> FTP Client thread FAILED to write data chunk to file [%s] nmemb = %lu, result = %lu\n",fullFilePath.c_str(),nmemb,result);
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client thread FAILED to write data chunk to file [%s] nmemb = %lu, result = %lu\n",fullFilePath.c_str(),nmemb,result);
SystemFlags::OutputDebug(SystemFlags::debugError,"===> FTP Client thread FAILED to write data chunk to file [%s] nmemb = %lu, result = %lu\n",fullFilePath.c_str(),nmemb,result);
//return -1; /* failure, can't open file to write */
}
return result;
}
/*