Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Notify requests about network reachability in priority order
Browse files Browse the repository at this point in the history
  • Loading branch information
alexshalamov committed Jan 14, 2019
1 parent d37918c commit c0c1c73
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion platform/default/src/mbgl/storage/online_file_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,15 @@ class OnlineFileSource::Impl {
private:

void networkIsReachableAgain() {
for (auto& request : allRequests) {
// Notify requests about network reachability in order of their priority.
std::vector<decltype(allRequests)::value_type> requests;
requests.reserve(allRequests.size());
requests.insert(requests.end(), allRequests.begin(), allRequests.end());
std::sort(requests.begin(), requests.end(), [](auto& a, auto&) {
return a->resource.priority == Resource::Priority::Regular;
});

for (auto& request : requests) {
request->networkIsReachableAgain();
}
}
Expand Down

0 comments on commit c0c1c73

Please sign in to comment.