mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 06:02:41 -04:00
made complete files stay in the download list
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2373 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
5263a49038
commit
5633e7b5f4
1 changed files with 28 additions and 13 deletions
|
@ -110,13 +110,32 @@ bool ftController::getFileDownloadChunksDetails(const std::string& hash,FileChun
|
||||||
|
|
||||||
std::map<std::string, ftFileControl>::iterator it = mDownloads.find(hash) ;
|
std::map<std::string, ftFileControl>::iterator it = mDownloads.find(hash) ;
|
||||||
|
|
||||||
if(it == mDownloads.end())
|
if(it != mDownloads.end())
|
||||||
return false ;
|
{
|
||||||
|
it->second.mCreator->getChunkMap(info) ;
|
||||||
|
info.flags = it->second.mFlags ;
|
||||||
|
|
||||||
it->second.mCreator->getChunkMap(info) ;
|
return true ;
|
||||||
info.flags = it->second.mFlags ;
|
}
|
||||||
|
|
||||||
return true ;
|
it = mCompleted.find(hash) ;
|
||||||
|
|
||||||
|
if(it != mCompleted.end())
|
||||||
|
{
|
||||||
|
// This should rather be done as a static method of ChunkMap.
|
||||||
|
//
|
||||||
|
info.file_size = it->second.mSize ;
|
||||||
|
info.chunk_size = ChunkMap::CHUNKMAP_FIXED_CHUNK_SIZE ;
|
||||||
|
info.flags = it->second.mFlags ;
|
||||||
|
uint32_t nb_chunks = it->second.mSize/ChunkMap::CHUNKMAP_FIXED_CHUNK_SIZE ;
|
||||||
|
if(it->second.mSize % ChunkMap::CHUNKMAP_FIXED_CHUNK_SIZE != 0)
|
||||||
|
++nb_chunks ;
|
||||||
|
info.chunks.resize(nb_chunks,FileChunksInfo::CHUNK_DONE) ;
|
||||||
|
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ftController::addFileSource(const std::string& hash,const std::string& peer_id)
|
void ftController::addFileSource(const std::string& hash,const std::string& peer_id)
|
||||||
|
@ -519,11 +538,8 @@ bool ftController::completeFile(std::string hash)
|
||||||
fc->mState = ftFileControl::ERROR_COMPLETION;
|
fc->mState = ftFileControl::ERROR_COMPLETION;
|
||||||
|
|
||||||
/* switch map */
|
/* switch map */
|
||||||
if (fc->mFlags & RS_FILE_HINTS_CACHE) /* clean up completed cache files automatically */
|
if (!(fc->mFlags & RS_FILE_HINTS_CACHE)) /* clean up completed cache files automatically */
|
||||||
{
|
|
||||||
mCompleted[fc->mHash] = *fc;
|
mCompleted[fc->mHash] = *fc;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* for extralist additions */
|
/* for extralist additions */
|
||||||
path = fc->mDestination;
|
path = fc->mDestination;
|
||||||
|
@ -1110,8 +1126,9 @@ bool ftController::FileClearCompleted()
|
||||||
#ifdef CONTROL_DEBUG
|
#ifdef CONTROL_DEBUG
|
||||||
std::cerr << "ftController::FileClearCompleted()" <<std::endl;
|
std::cerr << "ftController::FileClearCompleted()" <<std::endl;
|
||||||
#endif
|
#endif
|
||||||
mCompleted.clear();
|
mCompleted.clear();
|
||||||
IndicateConfigChanged();
|
IndicateConfigChanged();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1254,9 +1271,7 @@ bool ftController::FileDetails(std::string hash, FileInfo &info)
|
||||||
std::list<std::string>::iterator pit;
|
std::list<std::string>::iterator pit;
|
||||||
|
|
||||||
if (!completed)
|
if (!completed)
|
||||||
{
|
|
||||||
it->second.mTransfer->getFileSources(peerIds);
|
it->second.mTransfer->getFileSources(peerIds);
|
||||||
}
|
|
||||||
|
|
||||||
double totalRate = 0;
|
double totalRate = 0;
|
||||||
uint32_t tfRate = 0;
|
uint32_t tfRate = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue