| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 316 |
| 317 if (resolver->GetError() == 0) { | 317 if (resolver->GetError() == 0) { |
| 318 rtc::SocketAddress addr(resolver->address().ipaddr(), | 318 rtc::SocketAddress addr(resolver->address().ipaddr(), |
| 319 resolver->address().port()); | 319 resolver->address().port()); |
| 320 all_servers_addrs_.push_back(addr); | 320 all_servers_addrs_.push_back(addr); |
| 321 } | 321 } |
| 322 | 322 |
| 323 // Deletion of AsyncResolverInterface can't be done in OnResolveResult which | 323 // Deletion of AsyncResolverInterface can't be done in OnResolveResult which |
| 324 // handles SignalDone. | 324 // handles SignalDone. |
| 325 invoker_.AsyncInvoke<void>( | 325 invoker_.AsyncInvoke<void>( |
| 326 thread_, | 326 RTC_FROM_HERE, thread_, |
| 327 rtc::Bind(&rtc::AsyncResolverInterface::Destroy, resolver, false)); | 327 rtc::Bind(&rtc::AsyncResolverInterface::Destroy, resolver, false)); |
| 328 servers_.pop_back(); | 328 servers_.pop_back(); |
| 329 | 329 |
| 330 if (servers_.size()) { | 330 if (servers_.size()) { |
| 331 if (!ResolveServerName(servers_.back())) { | 331 if (!ResolveServerName(servers_.back())) { |
| 332 ReportOnPrepared(RESOLVE_FAILED); | 332 ReportOnPrepared(RESOLVE_FAILED); |
| 333 } | 333 } |
| 334 return; | 334 return; |
| 335 } | 335 } |
| 336 | 336 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 return THREAD_WAKE_UP_INTERVAL_MS; | 411 return THREAD_WAKE_UP_INTERVAL_MS; |
| 412 } | 412 } |
| 413 } | 413 } |
| 414 | 414 |
| 415 void StunProber::MaybeScheduleStunRequests() { | 415 void StunProber::MaybeScheduleStunRequests() { |
| 416 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 416 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 417 int64_t now = rtc::TimeMillis(); | 417 int64_t now = rtc::TimeMillis(); |
| 418 | 418 |
| 419 if (Done()) { | 419 if (Done()) { |
| 420 invoker_.AsyncInvokeDelayed<void>( | 420 invoker_.AsyncInvokeDelayed<void>( |
| 421 thread_, rtc::Bind(&StunProber::ReportOnFinished, this, SUCCESS), | 421 RTC_FROM_HERE, thread_, |
| 422 timeout_ms_); | 422 rtc::Bind(&StunProber::ReportOnFinished, this, SUCCESS), timeout_ms_); |
| 423 return; | 423 return; |
| 424 } | 424 } |
| 425 if (should_send_next_request(now)) { | 425 if (should_send_next_request(now)) { |
| 426 if (!SendNextRequest()) { | 426 if (!SendNextRequest()) { |
| 427 ReportOnFinished(GENERIC_FAILURE); | 427 ReportOnFinished(GENERIC_FAILURE); |
| 428 return; | 428 return; |
| 429 } | 429 } |
| 430 next_request_time_ms_ = now + interval_ms_; | 430 next_request_time_ms_ = now + interval_ms_; |
| 431 } | 431 } |
| 432 invoker_.AsyncInvokeDelayed<void>( | 432 invoker_.AsyncInvokeDelayed<void>( |
| 433 thread_, rtc::Bind(&StunProber::MaybeScheduleStunRequests, this), | 433 RTC_FROM_HERE, thread_, |
| 434 rtc::Bind(&StunProber::MaybeScheduleStunRequests, this), |
| 434 get_wake_up_interval_ms()); | 435 get_wake_up_interval_ms()); |
| 435 } | 436 } |
| 436 | 437 |
| 437 bool StunProber::GetStats(StunProber::Stats* prob_stats) const { | 438 bool StunProber::GetStats(StunProber::Stats* prob_stats) const { |
| 438 // No need to be on the same thread. | 439 // No need to be on the same thread. |
| 439 if (!prob_stats) { | 440 if (!prob_stats) { |
| 440 return false; | 441 return false; |
| 441 } | 442 } |
| 442 | 443 |
| 443 StunProber::Stats stats; | 444 StunProber::Stats stats; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 } | 564 } |
| 564 } | 565 } |
| 565 | 566 |
| 566 void StunProber::ReportOnFinished(StunProber::Status status) { | 567 void StunProber::ReportOnFinished(StunProber::Status status) { |
| 567 if (observer_) { | 568 if (observer_) { |
| 568 observer_->OnFinished(this, status); | 569 observer_->OnFinished(this, status); |
| 569 } | 570 } |
| 570 } | 571 } |
| 571 | 572 |
| 572 } // namespace stunprober | 573 } // namespace stunprober |
| OLD | NEW |