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

Side by Side Diff: net/proxy/proxy_list.cc

Issue 7532011: Only mark a proxy as bad if we have confirmation that another proxy succeeded for the same request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better names Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/proxy/proxy_list.h" 5 #include "net/proxy/proxy_list.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_tokenizer.h" 8 #include "base/string_tokenizer.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "net/proxy/proxy_server.h" 10 #include "net/proxy/proxy_server.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 std::string proxy_list; 108 std::string proxy_list;
109 std::vector<ProxyServer>::const_iterator iter = proxies_.begin(); 109 std::vector<ProxyServer>::const_iterator iter = proxies_.begin();
110 for (; iter != proxies_.end(); ++iter) { 110 for (; iter != proxies_.end(); ++iter) {
111 if (!proxy_list.empty()) 111 if (!proxy_list.empty())
112 proxy_list += ";"; 112 proxy_list += ";";
113 proxy_list += iter->ToPacString(); 113 proxy_list += iter->ToPacString();
114 } 114 }
115 return proxy_list.empty() ? std::string() : proxy_list; 115 return proxy_list.empty() ? std::string() : proxy_list;
116 } 116 }
117 117
118 bool ProxyList::Fallback(ProxyRetryInfoMap* proxy_retry_info) { 118 bool ProxyList::Fallback(ProxyRetryInfoMap* proxy_retry_info,
119 const BoundNetLog& net_log) {
119 // Number of minutes to wait before retrying a bad proxy server. 120 // Number of minutes to wait before retrying a bad proxy server.
120 const TimeDelta kProxyRetryDelay = TimeDelta::FromMinutes(5); 121 const TimeDelta kProxyRetryDelay = TimeDelta::FromMinutes(5);
121 122
122 // TODO(eroman): It would be good if instead of removing failed proxies 123 // TODO(eroman): It would be good if instead of removing failed proxies
eroman 2011/08/19 21:25:32 My thinking in this comment was to do away with Pr
123 // from the list, we simply annotated them with the error code they failed 124 // from the list, we simply annotated them with the error code they failed
124 // with. Of course, ProxyService::ReconsiderProxyAfterError() would need to 125 // with. Of course, ProxyService::ReconsiderProxyAfterError() would need to
125 // be given this information by the network transaction. 126 // be given this information by the network transaction.
126 // 127 //
127 // The advantage of this approach is when the network transaction 128 // The advantage of this approach is when the network transaction
128 // fails, we could output the full list of proxies that were attempted, and 129 // fails, we could output the full list of proxies that were attempted, and
129 // why each one of those failed (as opposed to just the last failure). 130 // why each one of those failed (as opposed to just the last failure).
130 // 131 //
131 // And also, before failing the transaction wholesale, we could go back and 132 // And also, before failing the transaction wholesale, we could go back and
132 // retry the "bad proxies" which we never tried to begin with. 133 // retry the "bad proxies" which we never tried to begin with.
(...skipping 12 matching lines...) Expand all
145 if (iter != proxy_retry_info->end()) { 146 if (iter != proxy_retry_info->end()) {
146 // TODO(nsylvain): This is not the first time we get this. We should 147 // TODO(nsylvain): This is not the first time we get this. We should
147 // double the retry time. Bug 997660. 148 // double the retry time. Bug 997660.
148 iter->second.bad_until = TimeTicks::Now() + iter->second.current_delay; 149 iter->second.bad_until = TimeTicks::Now() + iter->second.current_delay;
149 } else { 150 } else {
150 ProxyRetryInfo retry_info; 151 ProxyRetryInfo retry_info;
151 retry_info.current_delay = kProxyRetryDelay; 152 retry_info.current_delay = kProxyRetryDelay;
152 retry_info.bad_until = TimeTicks().Now() + retry_info.current_delay; 153 retry_info.bad_until = TimeTicks().Now() + retry_info.current_delay;
153 (*proxy_retry_info)[key] = retry_info; 154 (*proxy_retry_info)[key] = retry_info;
154 } 155 }
156 net_log.AddEvent(
157 NetLog::TYPE_PROXY_LIST_FALLBACK,
158 make_scoped_refptr(new NetLogStringParameter("bad_proxy", key)));
155 } 159 }
156 160
157 // Remove this proxy from our list. 161 // Remove this proxy from our list.
158 proxies_.erase(proxies_.begin()); 162 proxies_.erase(proxies_.begin());
159 163
160 return !proxies_.empty(); 164 return !proxies_.empty();
161 } 165 }
162 166
163 } // namespace net 167 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_list.h ('k') | net/proxy/proxy_service.h » ('j') | net/proxy/proxy_service.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698