mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
changed policy for canceling cache files: only inactive transfers get canceled now.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4160 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
1698e17380
commit
f110bad74c
@ -346,18 +346,20 @@ void ftController::setPriority(const std::string& hash,DwlSpeed p)
|
|||||||
void ftController::cleanCacheDownloads()
|
void ftController::cleanCacheDownloads()
|
||||||
{
|
{
|
||||||
std::vector<std::string> toCancel ;
|
std::vector<std::string> toCancel ;
|
||||||
|
time_t now = time(NULL) ;
|
||||||
|
|
||||||
{
|
{
|
||||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||||
|
|
||||||
for(std::map<std::string,ftFileControl*>::iterator it(mDownloads.begin());it!=mDownloads.end();++it)
|
for(std::map<std::string,ftFileControl*>::iterator it(mDownloads.begin());it!=mDownloads.end();++it)
|
||||||
if ((it->second)->mFlags & RS_FILE_HINTS_CACHE) //check if a cache file is downloaded, if the case, timeout the transfer after TIMOUT_CACHE_FILE_TRANSFER
|
if ((it->second)->mFlags & RS_FILE_HINTS_CACHE)
|
||||||
|
// check if a cache file is downloaded, if the case, timeout the transfer after TIMOUT_CACHE_FILE_TRANSFER
|
||||||
{
|
{
|
||||||
#ifdef CONTROL_DEBUG
|
#ifdef CONTROL_DEBUG
|
||||||
std::cerr << "ftController::run() cache transfer found. age of this tranfer is :" << (int)(time(NULL) - (it->second)->mCreateTime);
|
std::cerr << "ftController::run() cache transfer found. age of this tranfer is :" << (int)(time(NULL) - (it->second)->mCreateTime);
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if ((time(NULL) - (it->second)->mCreateTime) > TIMOUT_CACHE_FILE_TRANSFER)
|
if ((now - (it->second)->mCreator->lastRecvTimeStamp()) > TIMOUT_CACHE_FILE_TRANSFER)
|
||||||
{
|
{
|
||||||
#ifdef CONTROL_DEBUG
|
#ifdef CONTROL_DEBUG
|
||||||
std::cerr << "ftController::run() cache transfer to old. Cancelling transfer. Hash :" << (it->second)->mHash << ", time=" << (it->second)->mCreateTime << ", now = " << time(NULL) ;
|
std::cerr << "ftController::run() cache transfer to old. Cancelling transfer. Hash :" << (it->second)->mHash << ", time=" << (it->second)->mCreateTime << ", now = " << time(NULL) ;
|
||||||
|
@ -60,7 +60,7 @@ class p3turtle ;
|
|||||||
const uint32_t FC_TRANSFER_COMPLETE = 0x0001;
|
const uint32_t FC_TRANSFER_COMPLETE = 0x0001;
|
||||||
|
|
||||||
//timeouts in seconds
|
//timeouts in seconds
|
||||||
const int TIMOUT_CACHE_FILE_TRANSFER = 300;
|
const int TIMOUT_CACHE_FILE_TRANSFER = 800;
|
||||||
|
|
||||||
class ftFileControl
|
class ftFileControl
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user