Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tracker selection #2157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/AnnounceList.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,15 @@ void AnnounceList::announceSuccess()
if (currentTrackerInitialized_) {
(*currentTier_)->nextEvent();
auto url = *currentTracker_;
(*currentTier_)->urls.erase(currentTracker_);
currentTracker_ = (*currentTier_)->urls.erase(currentTracker_);
(*currentTier_)->urls.push_front(std::move(url));
currentTier_ = std::begin(tiers_);
currentTracker_ = std::begin((*currentTier_)->urls);
if (currentTracker_ == std::end((*currentTier_)->urls)) {
++currentTier_;
if (currentTier_ == std::end(tiers_)) {
currentTier_ = std::begin(tiers_);
}
currentTracker_ = std::begin((*currentTier_)->urls);
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/AnnounceList.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ class AnnounceList {
/**
* Removes current announce URL from its group and inserts it before the
* first element of the group.
* The internal announce group pointer points to the first element of the
* first group after this call.
* The internal announce group pointer points to the next element.
* If the current URL is the last element of its group, then the first
* element of the next group is pointed.
*/
void announceSuccess();

Expand Down