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

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

Issue 473513002: Keep track of network error in ProxyRetryInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments by rsleevi - 2 Created 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef NET_PROXY_PROXY_LIST_H_ 5 #ifndef NET_PROXY_PROXY_LIST_H_
6 #define NET_PROXY_PROXY_LIST_H_ 6 #define NET_PROXY_PROXY_LIST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // Does a best-effort parse, and silently discards any errors. 71 // Does a best-effort parse, and silently discards any errors.
72 void SetFromPacString(const std::string& pac_string); 72 void SetFromPacString(const std::string& pac_string);
73 73
74 // Returns a PAC-style semicolon-separated list of valid proxy servers. 74 // Returns a PAC-style semicolon-separated list of valid proxy servers.
75 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy". 75 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy".
76 std::string ToPacString() const; 76 std::string ToPacString() const;
77 77
78 // Returns a serialized value for the list. The caller takes ownership of it. 78 // Returns a serialized value for the list. The caller takes ownership of it.
79 base::ListValue* ToValue() const; 79 base::ListValue* ToValue() const;
80 80
81 // Marks the current proxy server as bad and deletes it from the list. The 81 // Marks the current proxy server as bad and deletes it from the list. The
82 // list of known bad proxies is given by proxy_retry_info. Returns true if 82 // list of known bad proxies is given by |proxy_retry_info|. |net_error|
83 // there is another server available in the list. 83 // should contain the network error encountered when this proxy was tried, if
84 // any. If this fallback is not because of a network error, then |OK| should
85 // be passed in (eg. a component added the proxy to the retry list so that it
86 // is not used). Returns true if there is another server available in the
Ryan Sleevi 2014/08/15 18:02:36 (e.g. for reasons such as local policy)
Not at Google. Contact bengr 2014/08/15 19:56:53 Done.
87 // list.
84 bool Fallback(ProxyRetryInfoMap* proxy_retry_info, 88 bool Fallback(ProxyRetryInfoMap* proxy_retry_info,
89 int net_error,
85 const BoundNetLog& net_log); 90 const BoundNetLog& net_log);
86 91
87 // Updates |proxy_retry_info| to indicate that the first proxy in the list 92 // Updates |proxy_retry_info| to indicate that the first proxy in the list
88 // is bad. This is distinct from Fallback(), above, to allow updating proxy 93 // is bad. This is distinct from Fallback(), above, to allow updating proxy
89 // retry information without modifying a given transction's proxy list. Will 94 // retry information without modifying a given transction's proxy list. Will
90 // retry after |retry_delay| if positive, and will use the default proxy retry 95 // retry after |retry_delay| if positive, and will use the default proxy retry
91 // duration otherwise. It may reconsider the proxy beforehand if |reconsider| 96 // duration otherwise. It may reconsider the proxy beforehand if |reconsider|
92 // is true. Additionally updates |proxy_retry_info| with 97 // is true. Additionally updates |proxy_retry_info| with
93 // |another_proxy_to_bypass| if non-empty. 98 // |another_proxy_to_bypass| if non-empty. |net_error| should contain the
99 // network error encountered when this proxy was tried, if any. If retry info
100 // is not being updated because of a network error, then |OK| should be passed
101 // in.
Ryan Sleevi 2014/08/15 18:02:36 I'm having trouble parsing this last sentence. Pe
Not at Google. Contact bengr 2014/08/15 19:56:53 Done.
94 void UpdateRetryInfoOnFallback( 102 void UpdateRetryInfoOnFallback(
95 ProxyRetryInfoMap* proxy_retry_info, 103 ProxyRetryInfoMap* proxy_retry_info,
96 base::TimeDelta retry_delay, 104 base::TimeDelta retry_delay,
97 bool reconsider, 105 bool reconsider,
98 const ProxyServer& another_proxy_to_bypass, 106 const ProxyServer& another_proxy_to_bypass,
107 int net_error,
99 const BoundNetLog& net_log) const; 108 const BoundNetLog& net_log) const;
100 109
101 private: 110 private:
102 // Updates |proxy_retry_info| to indicate that the |proxy_to_retry| in 111 // Updates |proxy_retry_info| to indicate that the |proxy_to_retry| in
103 // |proxies_| is bad for |retry_delay|, but may be reconsidered earlier if 112 // |proxies_| is bad for |retry_delay|, but may be reconsidered earlier if
104 // |try_while_bad| is true. 113 // |try_while_bad| is true. |net_error| should contain the network error
114 // encountered when this proxy was tried if any, which is responsible for it
115 // being put in the retry list. If the proxy is being added to the retry list
116 // for a reason other than a network error, then |OK| should be passed in.
Ryan Sleevi 2014/08/15 18:02:36 Ditto reword
Not at Google. Contact bengr 2014/08/15 19:56:53 Done.
105 void AddProxyToRetryList(ProxyRetryInfoMap* proxy_retry_info, 117 void AddProxyToRetryList(ProxyRetryInfoMap* proxy_retry_info,
106 base::TimeDelta retry_delay, 118 base::TimeDelta retry_delay,
107 bool try_while_bad, 119 bool try_while_bad,
108 const ProxyServer& proxy_to_retry, 120 const ProxyServer& proxy_to_retry,
121 int net_error,
109 const BoundNetLog& net_log) const; 122 const BoundNetLog& net_log) const;
110 123
111 // List of proxies. 124 // List of proxies.
112 std::vector<ProxyServer> proxies_; 125 std::vector<ProxyServer> proxies_;
113 }; 126 };
114 127
115 } // namespace net 128 } // namespace net
116 129
117 #endif // NET_PROXY_PROXY_LIST_H_ 130 #endif // NET_PROXY_PROXY_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698