remove temporary file when cancel file transfer

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@859 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
ewensun 2008-11-30 21:43:51 +00:00
parent 9f727e2d94
commit 3453604c4d

View File

@ -698,9 +698,28 @@ bool ftController::FileCancel(std::string hash)
fc->mCreator = NULL;
}
fc->mState = ftFileControl::ERROR_COMPLETION;
/* delete the temporary file */
if (0 == remove(fc->mCurrentPath.c_str()))
{
#ifdef CONTROL_DEBUG
std::cerr << "ftController::FileCancel() remove temporary file ";
std::cerr << fc->mCurrentPath;
std::cerr << std::endl;
#endif
}
else
{
#ifdef CONTROL_DEBUG
std::cerr << "ftController::FileCancel() fail to remove file ";
std::cerr << fc->mCurrentPath;
std::cerr << std::endl;
#endif
}
//fc->mState = ftFileControl::ERROR_COMPLETION;
mDownloads.erase(mit);
IndicateConfigChanged(); /* completed transfer -> save */
return true;
}