it happens sometimes that files of size 0 are transfered. In such a case the destination file is not written down, and the following calls to moveFile in ftcontroller.cc produce an error. Ive put an if to avoid this.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1117 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2009-04-06 19:41:40 +00:00
parent 9d89c12a38
commit 1ff00dcf07

View File

@ -318,7 +318,10 @@ bool ftController::completeFile(std::string hash)
fc->mState = ftFileControl::COMPLETED; fc->mState = ftFileControl::COMPLETED;
if( moveFile(fc->mCurrentPath,fc->mDestination) ) // I don't know how the size can be zero, but believe me, this happens,
// and it causes an error on linux because then the file may not even exist.
//
if( fc->mSize > 0 && moveFile(fc->mCurrentPath,fc->mDestination) )
fc->mCurrentPath = fc->mDestination; fc->mCurrentPath = fc->mDestination;
else else
fc->mState = ftFileControl::ERROR_COMPLETION; fc->mState = ftFileControl::ERROR_COMPLETION;
@ -338,6 +341,10 @@ bool ftController::completeFile(std::string hash)
period = 30 * 24 * 3600; /* 30 days */ period = 30 * 24 * 3600; /* 30 days */
flags = 0; flags = 0;
#ifdef CONTROL_DEBUG
std::cerr << "CompleteFile(): size = " << size << std::endl ;
#endif
doCallback = fc->mDoCallback; doCallback = fc->mDoCallback;
callbackCode = fc->mCallbackCode; callbackCode = fc->mCallbackCode;