mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 16:09:37 -05:00
removed cache adding strategy to DL queue that was O(n^2). Now addign cache at the end of the queue
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4930 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
07ea6829b6
commit
c4be65e0ab
@ -468,6 +468,7 @@ void ftController::locked_addToQueue(ftFileControl* ftfc,int add_strategy)
|
||||
case FT_FILECONTROL_QUEUE_ADD_AFTER_CACHE:
|
||||
{
|
||||
// We add the transfer just before the first non cache transfer.
|
||||
// This is costly, so only use this in case we really need it.
|
||||
//
|
||||
uint32_t pos =0;
|
||||
while(pos < _queue.size() && (pos < _min_prioritized_transfers || (_queue[pos]->mFlags & RS_FILE_HINTS_CACHE)>0) )
|
||||
@ -1274,7 +1275,7 @@ bool ftController::FileRequest(const std::string& fname, const std::string& has
|
||||
/* add structures into the accessible data. Needs to be locked */
|
||||
{
|
||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||
locked_addToQueue(ftfc, (flags & RS_FILE_HINTS_CACHE)?FT_FILECONTROL_QUEUE_ADD_AFTER_CACHE : FT_FILECONTROL_QUEUE_ADD_END ) ;
|
||||
locked_addToQueue(ftfc, FT_FILECONTROL_QUEUE_ADD_END ) ;
|
||||
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "ftController::FileRequest() Created ftFileCreator @: " << fc;
|
||||
|
Loading…
Reference in New Issue
Block a user