Index: webrtc/base/autodetectproxy.cc |
diff --git a/webrtc/base/autodetectproxy.cc b/webrtc/base/autodetectproxy.cc |
index e563304fb58f79b9a7689e8800a5cdff92aa3872..3b4e1f4fc591a1c55e3d66ee9cc0684b6acca9b0 100644 |
--- a/webrtc/base/autodetectproxy.cc |
+++ b/webrtc/base/autodetectproxy.cc |
@@ -75,7 +75,7 @@ void AutoDetectProxy::OnMessage(Message *msg) { |
// If we can't resolve the proxy, skip straight to failure. |
Complete(PROXY_UNKNOWN); |
} else if (MSG_TIMEOUT == msg->message_id) { |
- OnCloseEvent(socket_, ETIMEDOUT); |
+ OnTimeout(); |
} else { |
// This must be the ST_MSG_WORKER_DONE message that deletes the |
// AutoDetectProxy object. We have observed crashes within this stack that |
@@ -279,6 +279,19 @@ void AutoDetectProxy::OnReadEvent(AsyncSocket * socket) { |
Next(); |
} |
+void AutoDetectProxy::OnTimeout() { |
+ LOG(LS_VERBOSE) << "Timed out waiting for AsyncResolver."; |
+ // If a resolver timed out we shouldn't try to use it again since it may be |
+ // in the middle of resolving the last address. |
+ if (resolver_) { |
+ resolver_->SignalDone.disconnect(this); |
+ resolver_->Destroy(false); |
+ resolver_ = nullptr; |
+ } |
+ ++next_; |
+ Next(); |
+} |
+ |
void AutoDetectProxy::OnCloseEvent(AsyncSocket * socket, int error) { |
LOG(LS_VERBOSE) << "AutoDetectProxy closed with error: " << error; |
++next_; |