QueueItemPtr UserQueue::getNext(const UserPtr& aUser, const OrderedStringSet& onlineHubs, QueueItem::Priority minPrio, int64_t wantedSize, int64_t lastSpeed, bool smallSlot, bool allowOverlap /*false*/) { /* Using the PAUSED priority will list all files */ QueueItemPtr qi = getNextPrioQI(aUser, onlineHubs, 0, 0, smallSlot, allowOverlap); if(!qi) { qi = getNextBundleQI(aUser, onlineHubs, (Bundle::Priority)minPrio, wantedSize, lastSpeed, smallSlot, allowOverlap); } if (!qi && !allowOverlap) { //no free segments. let's do another round and now check if there are slow sources which can be overlapped qi = getNext(aUser, onlineHubs, minPrio, wantedSize, lastSpeed, smallSlot, true); } return qi; }
QueueItemPtr UserQueue::getNext(const UserPtr& aUser, const QueueTokenSet& runningBundles, const OrderedStringSet& onlineHubs, string& lastError_, bool& hasDownload, QueueItemBase::Priority minPrio, int64_t wantedSize, int64_t lastSpeed, QueueItemBase::DownloadType aType, bool allowOverlap /*false*/) noexcept { /* Using the PAUSED priority will list all files */ auto qi = getNextPrioQI(aUser, onlineHubs, 0, 0, aType, allowOverlap, lastError_); if(!qi) { qi = getNextBundleQI(aUser, runningBundles, onlineHubs, (QueueItemBase::Priority)minPrio, wantedSize, lastSpeed, aType, allowOverlap, lastError_, hasDownload); } if (!qi && !allowOverlap) { //no free segments. let's do another round and now check if there are slow sources which can be overlapped qi = getNext(aUser, runningBundles, onlineHubs, lastError_, hasDownload, minPrio, wantedSize, lastSpeed, aType, true); } if (qi) hasDownload = true; return qi; }