OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // TODO: If we found a proxy, try to use it to verify that it | 68 // TODO: If we found a proxy, try to use it to verify that it |
69 // works by sending a request to server_url. This could either be | 69 // works by sending a request to server_url. This could either be |
70 // done here or by the HttpPortAllocator. | 70 // done here or by the HttpPortAllocator. |
71 } | 71 } |
72 | 72 |
73 void AutoDetectProxy::OnMessage(Message *msg) { | 73 void AutoDetectProxy::OnMessage(Message *msg) { |
74 if (MSG_UNRESOLVABLE == msg->message_id) { | 74 if (MSG_UNRESOLVABLE == msg->message_id) { |
75 // If we can't resolve the proxy, skip straight to failure. | 75 // If we can't resolve the proxy, skip straight to failure. |
76 Complete(PROXY_UNKNOWN); | 76 Complete(PROXY_UNKNOWN); |
77 } else if (MSG_TIMEOUT == msg->message_id) { | 77 } else if (MSG_TIMEOUT == msg->message_id) { |
78 OnCloseEvent(socket_, ETIMEDOUT); | 78 OnTimeout(); |
79 } else { | 79 } else { |
80 // This must be the ST_MSG_WORKER_DONE message that deletes the | 80 // This must be the ST_MSG_WORKER_DONE message that deletes the |
81 // AutoDetectProxy object. We have observed crashes within this stack that | 81 // AutoDetectProxy object. We have observed crashes within this stack that |
82 // seem to be highly reproducible for a small subset of users and thus are | 82 // seem to be highly reproducible for a small subset of users and thus are |
83 // probably correlated with a specific proxy setting, so copy potentially | 83 // probably correlated with a specific proxy setting, so copy potentially |
84 // relevant information onto the stack to make it available in Windows | 84 // relevant information onto the stack to make it available in Windows |
85 // minidumps. | 85 // minidumps. |
86 | 86 |
87 // Save the user agent and the number of auto-detection passes that we | 87 // Save the user agent and the number of auto-detection passes that we |
88 // needed. | 88 // needed. |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 break; | 272 break; |
273 default: | 273 default: |
274 ASSERT(false); | 274 ASSERT(false); |
275 return; | 275 return; |
276 } | 276 } |
277 | 277 |
278 ++next_; | 278 ++next_; |
279 Next(); | 279 Next(); |
280 } | 280 } |
281 | 281 |
| 282 void AutoDetectProxy::OnTimeout() { |
| 283 LOG(LS_VERBOSE) << "Timed out waiting for AsyncResolver."; |
| 284 // If a resolver timed out we shouldn't try to use it again since it may be |
| 285 // in the middle of resolving the last address. |
| 286 if (resolver_) { |
| 287 resolver_->SignalDone.disconnect(this); |
| 288 resolver_->Destroy(false); |
| 289 resolver_ = nullptr; |
| 290 } |
| 291 ++next_; |
| 292 Next(); |
| 293 } |
| 294 |
282 void AutoDetectProxy::OnCloseEvent(AsyncSocket * socket, int error) { | 295 void AutoDetectProxy::OnCloseEvent(AsyncSocket * socket, int error) { |
283 LOG(LS_VERBOSE) << "AutoDetectProxy closed with error: " << error; | 296 LOG(LS_VERBOSE) << "AutoDetectProxy closed with error: " << error; |
284 ++next_; | 297 ++next_; |
285 Next(); | 298 Next(); |
286 } | 299 } |
287 | 300 |
288 } // namespace rtc | 301 } // namespace rtc |
OLD | NEW |