mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-12 19:12:28 -04:00
add fileControl and fileCancel code in ftController
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@720 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9d33feb6e6
commit
9b0bfb26c2
3 changed files with 320 additions and 236 deletions
|
@ -280,13 +280,57 @@ bool ftController::FileRequest(std::string fname, std::string hash,
|
|||
|
||||
bool ftController::FileCancel(std::string hash)
|
||||
{
|
||||
/* TODO */
|
||||
return false;
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ftController::FileCancel" << std::endl;
|
||||
#endif
|
||||
/*check if the file in the download map*/
|
||||
std::map<std::string,ftFileControl>::iterator mit;
|
||||
mit=mDownloads.find(hash);
|
||||
if (mit==mDownloads.end())
|
||||
{
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr<<"ftController::FileCancel file is not found in mDownloads"<<std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
/*find the point to transfer module*/
|
||||
ftTransferModule* ft=(mit->second).mTransfer;
|
||||
ft->cancelTransfer();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ftController::FileControl(std::string hash, uint32_t flags)
|
||||
{
|
||||
return false;
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ftController::FileControl(" << hash << ",";
|
||||
std::cerr << flags << ")"<<std::endl;
|
||||
#endif
|
||||
/*check if the file in the download map*/
|
||||
std::map<std::string,ftFileControl>::iterator mit;
|
||||
mit=mDownloads.find(hash);
|
||||
if (mit==mDownloads.end())
|
||||
{
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr<<"ftController::FileControl file is not found in mDownloads"<<std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
/*find the point to transfer module*/
|
||||
ftTransferModule* ft=(mit->second).mTransfer;
|
||||
switch (flags)
|
||||
{
|
||||
case RS_FILE_CTRL_PAUSE:
|
||||
ft->stopTransfer();
|
||||
break;
|
||||
case RS_FILE_CTRL_START:
|
||||
ft->resumeTransfer();
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ftController::FileClearCompleted()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue