summaryrefslogtreecommitdiffstats
path: root/net/proxy/init_proxy_resolver.h
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-26 05:12:47 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-26 05:12:47 +0000
commit1b8740fcc945425012ecc755987286dd22a098f6 (patch)
tree263ebd87b1ac8b50af8303085043f4bd930bd42f /net/proxy/init_proxy_resolver.h
parent924cad8b1c5bccdd34dd02d9391e57e5ed8a0f06 (diff)
downloadchromium_src-1b8740fcc945425012ecc755987286dd22a098f6.zip
chromium_src-1b8740fcc945425012ecc755987286dd22a098f6.tar.gz
chromium_src-1b8740fcc945425012ecc755987286dd22a098f6.tar.bz2
Introduce an artificial 2 second delay after network IP address changes before re-running proxy auto-config.
During this time network requests will be stalled. This is to work around a problem where DNS gives transient failures shortly after IP address changes. BUG=50779 TEST=On a linux laptop switch between wireless networks while using auto-detect. When you switch to a network that contains the host 'wpad' verify that when InitProxyResolver runs it does not get a DNS error resolving 'wpad'. (Use about:net-internals to view this information). Review URL: http://codereview.chromium.org/3151040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57471 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/init_proxy_resolver.h')
-rw-r--r--net/proxy/init_proxy_resolver.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/proxy/init_proxy_resolver.h b/net/proxy/init_proxy_resolver.h
index 6c417d5..1bdb4e8 100644
--- a/net/proxy/init_proxy_resolver.h
+++ b/net/proxy/init_proxy_resolver.h
@@ -9,6 +9,8 @@
#include <vector>
#include "base/string16.h"
+#include "base/time.h"
+#include "base/timer.h"
#include "googleurl/src/gurl.h"
#include "net/base/completion_callback.h"
#include "net/base/net_log.h"
@@ -47,12 +49,17 @@ class InitProxyResolver {
~InitProxyResolver();
// Apply the PAC settings of |config| to |resolver_|.
+ // If |wait_delay| is positive, the initialization will pause for this
+ // amount of time before getting started.
int Init(const ProxyConfig& config,
+ const base::TimeDelta wait_delay,
CompletionCallback* callback);
private:
enum State {
STATE_NONE,
+ STATE_WAIT,
+ STATE_WAIT_COMPLETE,
STATE_FETCH_PAC_SCRIPT,
STATE_FETCH_PAC_SCRIPT_COMPLETE,
STATE_SET_PAC_SCRIPT,
@@ -75,6 +82,9 @@ class InitProxyResolver {
int DoLoop(int result);
void DoCallback(int result);
+ int DoWait();
+ int DoWaitComplete(int result);
+
int DoFetchPacScript();
int DoFetchPacScriptComplete(int result);
@@ -94,6 +104,7 @@ class InitProxyResolver {
// Returns the current PAC URL we are fetching/testing.
const PacURL& current_pac_url() const;
+ void OnWaitTimerFired();
void DidCompleteInit();
void Cancel();
@@ -113,6 +124,9 @@ class InitProxyResolver {
BoundNetLog net_log_;
+ base::TimeDelta wait_delay_;
+ base::OneShotTimer<InitProxyResolver> wait_timer_;
+
DISALLOW_COPY_AND_ASSIGN(InitProxyResolver);
};