mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-07 00:25:16 -04:00
adding pending transfers 100 at a time instead of 1 at a time when loading
This commit is contained in:
parent
d8f621e9ec
commit
bc2c9d576e
1 changed files with 42 additions and 41 deletions
|
@ -825,15 +825,16 @@ bool ftController::isActiveAndNoPending()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ftController::handleAPendingRequest()
|
bool ftController::handleAPendingRequest()
|
||||||
|
{
|
||||||
|
uint32_t nb_requests_handled = 0 ;
|
||||||
|
static const uint32_t MAX_SIMULTANEOUS_PENDING_REQUESTS = 100 ;
|
||||||
|
|
||||||
|
while(!mPendingRequests.empty() && nb_requests_handled++ < MAX_SIMULTANEOUS_PENDING_REQUESTS)
|
||||||
{
|
{
|
||||||
ftPendingRequest req;
|
ftPendingRequest req;
|
||||||
{
|
{
|
||||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||||
|
|
||||||
if (mPendingRequests.size() < 1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
req = mPendingRequests.front();
|
req = mPendingRequests.front();
|
||||||
mPendingRequests.pop_front();
|
mPendingRequests.pop_front();
|
||||||
}
|
}
|
||||||
|
@ -880,8 +881,8 @@ bool ftController::handleAPendingRequest()
|
||||||
std::cerr << "No pending chunkmap for hash " << req.mHash << std::endl ;
|
std::cerr << "No pending chunkmap for hash " << req.mHash << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true ;
|
return !mPendingRequests.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ftController::alreadyHaveFile(const RsFileHash& hash, FileInfo &info)
|
bool ftController::alreadyHaveFile(const RsFileHash& hash, FileInfo &info)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue