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

Unified Diff: webrtc/base/autodetectproxy.cc

Issue 2104203002: Fixing flakiness of TestDetectUnresolvedProxy. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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 | « webrtc/base/autodetectproxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « webrtc/base/autodetectproxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698