diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-01-14 11:45:25 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-01-14 14:28:35 +0200 |
commit | f577e430dc418d2e6b1b0f1ff1ad4370c6ce5086 (patch) | |
tree | 645b663d580a93b519dfb8cbd4c25ac8c62763f9 | |
parent | d37918c169b2f688c96fb766fc671066c88fc1a2 (diff) | |
download | qtlocation-mapboxgl-upstream/alexshalamov_fix_flaky_onlinefilesource.tar.gz |
[core] Notify requests about network reachability in priority orderupstream/alexshalamov_fix_flaky_onlinefilesource
-rw-r--r-- | platform/default/src/mbgl/storage/online_file_source.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/platform/default/src/mbgl/storage/online_file_source.cpp b/platform/default/src/mbgl/storage/online_file_source.cpp index fce1c3e2b6..6d31049243 100644 --- a/platform/default/src/mbgl/storage/online_file_source.cpp +++ b/platform/default/src/mbgl/storage/online_file_source.cpp @@ -170,7 +170,15 @@ public: 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& b) { + return a->resource.priority < b->resource.priority; + }); + + for (auto& request : requests) { request->networkIsReachableAgain(); } } |