Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: net/proxy/proxy_list.cc

Issue 542029: Retry proxies which were cached as bad before giving up.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/proxy_list.h ('k') | net/proxy/proxy_list_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_list.cc
===================================================================
--- net/proxy/proxy_list.cc (revision 35979)
+++ net/proxy/proxy_list.cc (working copy)
@@ -31,8 +31,14 @@
proxies_.push_back(proxy_server);
}
-void ProxyList::RemoveBadProxies(const ProxyRetryInfoMap& proxy_retry_info) {
- std::vector<ProxyServer> new_proxy_list;
+void ProxyList::DeprioritizeBadProxies(
+ const ProxyRetryInfoMap& proxy_retry_info) {
+ // Partition the proxy list in two:
+ // (1) the known bad proxies
+ // (2) everything else
+ std::vector<ProxyServer> good_proxies;
+ std::vector<ProxyServer> bad_proxies;
+
std::vector<ProxyServer>::const_iterator iter = proxies_.begin();
for (; iter != proxies_.end(); ++iter) {
ProxyRetryInfoMap::const_iterator bad_proxy =
@@ -41,13 +47,16 @@
// This proxy is bad. Check if it's time to retry.
if (bad_proxy->second.bad_until >= TimeTicks::Now()) {
// still invalid.
+ bad_proxies.push_back(*iter);
continue;
}
}
- new_proxy_list.push_back(*iter);
+ good_proxies.push_back(*iter);
}
- proxies_ = new_proxy_list;
+ // "proxies_ = good_proxies + bad_proxies"
+ proxies_.swap(good_proxies);
+ proxies_.insert(proxies_.end(), bad_proxies.begin(), bad_proxies.end());
}
void ProxyList::RemoveProxiesWithoutScheme(int scheme_bit_field) {
« no previous file with comments | « net/proxy/proxy_list.h ('k') | net/proxy/proxy_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698