Fixing flakiness of TestDetectUnresolvedProxy.
If the AutoDetectProxy timed out resolving one address, it was attempting to use the same resolver to resolve the next address, which would always result in an assertion. This happened recently a couple times on the Windows DrMemory bot because of its slowness. TBR=pthatcher@webrtc.org Review URL: https://codereview.webrtc.org/2104203002 . Cr-Commit-Position: refs/heads/master@{#13326}
This commit is contained in:
parent
37f93af032
commit
54433e72aa
@ -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_;
|
||||
|
||||
@ -70,6 +70,7 @@ class AutoDetectProxy : public SignalThread {
|
||||
void OnConnectEvent(AsyncSocket * socket);
|
||||
void OnReadEvent(AsyncSocket * socket);
|
||||
void OnCloseEvent(AsyncSocket * socket, int error);
|
||||
void OnTimeout();
|
||||
void OnResolveResult(AsyncResolverInterface* resolver);
|
||||
bool DoConnect();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user