Merge pull request #1045 from csoler/v0.6-FT

adding pending transfers 100 at a time instead of 1 at a time when lo…
This commit is contained in:
csoler 2017-09-18 22:50:35 +02:00 committed by GitHub
commit 58ccf0bef4

View File

@ -825,15 +825,16 @@ bool ftController::isActiveAndNoPending()
}
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;
{
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
if (mPendingRequests.size() < 1)
{
return false;
}
req = mPendingRequests.front();
mPendingRequests.pop_front();
}
@ -880,8 +881,8 @@ bool ftController::handleAPendingRequest()
std::cerr << "No pending chunkmap for hash " << req.mHash << std::endl ;
#endif
}
return true ;
}
return !mPendingRequests.empty();
}
bool ftController::alreadyHaveFile(const RsFileHash& hash, FileInfo &info)