| 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 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 namespace cricket { | 41 namespace cricket { |
| 42 | 42 |
| 43 // This class groups the DTLS and ICE channels, and helps keep track of | 43 // This class groups the DTLS and ICE channels, and helps keep track of |
| 44 // how many external objects (BaseChannels) reference each channel. | 44 // how many external objects (BaseChannels) reference each channel. |
| 45 class TransportController::ChannelPair { | 45 class TransportController::ChannelPair { |
| 46 public: | 46 public: |
| 47 // TODO(deadbeef): Change the types of |dtls| and |ice| to | 47 // TODO(deadbeef): Change the types of |dtls| and |ice| to |
| 48 // DtlsTransportChannelWrapper and P2PTransportChannelWrapper, | 48 // DtlsTransportChannelWrapper and P2PTransportChannelWrapper, |
| 49 // once TransportChannelImpl is removed. | 49 // once TransportChannelImpl is removed. |
| 50 ChannelPair(TransportChannelImpl* dtls, TransportChannelImpl* ice) | 50 ChannelPair(DtlsTransportInternal* dtls, TransportChannelImpl* ice) |
| 51 : ice_(ice), dtls_(dtls) {} | 51 : ice_(ice), dtls_(dtls) {} |
| 52 | 52 |
| 53 // Currently, all ICE-related calls still go through this DTLS channel. But | 53 // Currently, all ICE-related calls still go through this DTLS channel. But |
| 54 // that will change once we get rid of TransportChannelImpl, and the DTLS | 54 // that will change once we get rid of TransportChannelImpl, and the DTLS |
| 55 // channel interface no longer includes ICE-specific methods. | 55 // channel interface no longer includes ICE-specific methods. |
| 56 const TransportChannelImpl* dtls() const { return dtls_.get(); } | 56 const DtlsTransportInternal* dtls() const { return dtls_.get(); } |
| 57 TransportChannelImpl* dtls() { return dtls_.get(); } | 57 DtlsTransportInternal* dtls() { return dtls_.get(); } |
| 58 const TransportChannelImpl* ice() const { return ice_.get(); } | 58 const TransportChannelImpl* ice() const { return ice_.get(); } |
| 59 TransportChannelImpl* ice() { return ice_.get(); } | 59 TransportChannelImpl* ice() { return ice_.get(); } |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 std::unique_ptr<TransportChannelImpl> ice_; | 62 std::unique_ptr<TransportChannelImpl> ice_; |
| 63 std::unique_ptr<TransportChannelImpl> dtls_; | 63 std::unique_ptr<DtlsTransportInternal> dtls_; |
| 64 | 64 |
| 65 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelPair); | 65 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelPair); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 TransportController::TransportController(rtc::Thread* signaling_thread, | 68 TransportController::TransportController(rtc::Thread* signaling_thread, |
| 69 rtc::Thread* network_thread, | 69 rtc::Thread* network_thread, |
| 70 PortAllocator* port_allocator, | 70 PortAllocator* port_allocator, |
| 71 bool redetermine_role_on_ice_restart) | 71 bool redetermine_role_on_ice_restart) |
| 72 : signaling_thread_(signaling_thread), | 72 : signaling_thread_(signaling_thread), |
| 73 network_thread_(network_thread), | 73 network_thread_(network_thread), |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 rtc::Bind(&TransportController::GetStats_n, this, transport_name, stats)); | 220 rtc::Bind(&TransportController::GetStats_n, this, transport_name, stats)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void TransportController::SetMetricsObserver( | 223 void TransportController::SetMetricsObserver( |
| 224 webrtc::MetricsObserverInterface* metrics_observer) { | 224 webrtc::MetricsObserverInterface* metrics_observer) { |
| 225 return network_thread_->Invoke<void>( | 225 return network_thread_->Invoke<void>( |
| 226 RTC_FROM_HERE, rtc::Bind(&TransportController::SetMetricsObserver_n, this, | 226 RTC_FROM_HERE, rtc::Bind(&TransportController::SetMetricsObserver_n, this, |
| 227 metrics_observer)); | 227 metrics_observer)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 TransportChannel* TransportController::CreateTransportChannel_n( | 230 DtlsTransportInternal* TransportController::CreateTransportChannel_n( |
| 231 const std::string& transport_name, | 231 const std::string& transport_name, |
| 232 int component) { | 232 int component) { |
| 233 RTC_DCHECK(network_thread_->IsCurrent()); | 233 RTC_DCHECK(network_thread_->IsCurrent()); |
| 234 | 234 |
| 235 RefCountedChannel* existing_channel = GetChannel_n(transport_name, component); | 235 RefCountedChannel* existing_channel = GetChannel_n(transport_name, component); |
| 236 if (existing_channel) { | 236 if (existing_channel) { |
| 237 // Channel already exists; increment reference count and return. | 237 // Channel already exists; increment reference count and return. |
| 238 existing_channel->AddRef(); | 238 existing_channel->AddRef(); |
| 239 return existing_channel->dtls(); | 239 return existing_channel->dtls(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 // Need to create a new channel. | 242 // Need to create a new channel. |
| 243 JsepTransport* transport = GetOrCreateJsepTransport(transport_name); | 243 JsepTransport* transport = GetOrCreateJsepTransport(transport_name); |
| 244 | 244 |
| 245 // Create DTLS channel wrapping ICE channel, and configure it. | 245 // Create DTLS channel wrapping ICE channel, and configure it. |
| 246 TransportChannelImpl* ice = | 246 TransportChannelImpl* ice = |
| 247 CreateIceTransportChannel_n(transport_name, component); | 247 CreateIceTransportChannel_n(transport_name, component); |
| 248 // TODO(deadbeef): To support QUIC, would need to create a | 248 // TODO(deadbeef): To support QUIC, would need to create a |
| 249 // QuicTransportChannel here. What is "dtls" in this file would then become | 249 // QuicTransportChannel here. What is "dtls" in this file would then become |
| 250 // "dtls or quic". | 250 // "dtls or quic". |
| 251 TransportChannelImpl* dtls = | 251 DtlsTransportInternal* dtls = |
| 252 CreateDtlsTransportChannel_n(transport_name, component, ice); | 252 CreateDtlsTransportChannel_n(transport_name, component, ice); |
| 253 dtls->SetMetricsObserver(metrics_observer_); | 253 dtls->ice_transport()->SetMetricsObserver(metrics_observer_); |
| 254 dtls->SetIceRole(ice_role_); | 254 dtls->ice_transport()->SetIceRole(ice_role_); |
| 255 dtls->SetIceTiebreaker(ice_tiebreaker_); | 255 dtls->ice_transport()->SetIceTiebreaker(ice_tiebreaker_); |
| 256 dtls->SetIceConfig(ice_config_); | 256 dtls->ice_transport()->SetIceConfig(ice_config_); |
| 257 if (certificate_) { | 257 if (certificate_) { |
| 258 bool set_cert_success = dtls->SetLocalCertificate(certificate_); | 258 bool set_cert_success = dtls->SetLocalCertificate(certificate_); |
| 259 RTC_DCHECK(set_cert_success); | 259 RTC_DCHECK(set_cert_success); |
| 260 } | 260 } |
| 261 | 261 |
| 262 // Connect to signals offered by the channels. Currently, the DTLS channel | 262 // Connect to signals offered by the channels. Currently, the DTLS channel |
| 263 // forwards signals from the ICE channel, so we only need to connect to the | 263 // forwards signals from the ICE channel, so we only need to connect to the |
| 264 // DTLS channel. In the future this won't be the case. | 264 // DTLS channel. In the future this won't be the case. |
| 265 dtls->SignalWritableState.connect( | 265 dtls->SignalWritableState.connect( |
| 266 this, &TransportController::OnChannelWritableState_n); | 266 this, &TransportController::OnChannelWritableState_n); |
| 267 dtls->SignalReceivingState.connect( | 267 dtls->SignalReceivingState.connect( |
| 268 this, &TransportController::OnChannelReceivingState_n); | 268 this, &TransportController::OnChannelReceivingState_n); |
| 269 dtls->SignalGatheringState.connect( | |
| 270 this, &TransportController::OnChannelGatheringState_n); | |
| 271 dtls->SignalCandidateGathered.connect( | |
| 272 this, &TransportController::OnChannelCandidateGathered_n); | |
| 273 dtls->SignalCandidatesRemoved.connect( | |
| 274 this, &TransportController::OnChannelCandidatesRemoved_n); | |
| 275 dtls->SignalRoleConflict.connect( | |
| 276 this, &TransportController::OnChannelRoleConflict_n); | |
| 277 dtls->SignalStateChanged.connect( | |
| 278 this, &TransportController::OnChannelStateChanged_n); | |
| 279 dtls->SignalDtlsHandshakeError.connect( | 269 dtls->SignalDtlsHandshakeError.connect( |
| 280 this, &TransportController::OnDtlsHandshakeError); | 270 this, &TransportController::OnDtlsHandshakeError); |
| 271 dtls->ice_transport()->SignalGatheringState.connect( |
| 272 this, &TransportController::OnChannelGatheringState_n); |
| 273 dtls->ice_transport()->SignalCandidateGathered.connect( |
| 274 this, &TransportController::OnChannelCandidateGathered_n); |
| 275 dtls->ice_transport()->SignalCandidatesRemoved.connect( |
| 276 this, &TransportController::OnChannelCandidatesRemoved_n); |
| 277 dtls->ice_transport()->SignalRoleConflict.connect( |
| 278 this, &TransportController::OnChannelRoleConflict_n); |
| 279 dtls->ice_transport()->SignalStateChanged.connect( |
| 280 this, &TransportController::OnChannelStateChanged_n); |
| 281 RefCountedChannel* new_pair = new RefCountedChannel(dtls, ice); | 281 RefCountedChannel* new_pair = new RefCountedChannel(dtls, ice); |
| 282 new_pair->AddRef(); | 282 new_pair->AddRef(); |
| 283 channels_.insert(channels_.end(), new_pair); | 283 channels_.insert(channels_.end(), new_pair); |
| 284 bool channel_added = transport->AddChannel(dtls, component); | 284 bool channel_added = transport->AddChannel(dtls, component); |
| 285 RTC_DCHECK(channel_added); | 285 RTC_DCHECK(channel_added); |
| 286 // Adding a channel could cause aggregate state to change. | 286 // Adding a channel could cause aggregate state to change. |
| 287 UpdateAggregateStates_n(); | 287 UpdateAggregateStates_n(); |
| 288 return dtls; | 288 return dtls; |
| 289 } | 289 } |
| 290 | 290 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 319 } | 319 } |
| 320 | 320 |
| 321 std::vector<std::string> TransportController::transport_names_for_testing() { | 321 std::vector<std::string> TransportController::transport_names_for_testing() { |
| 322 std::vector<std::string> ret; | 322 std::vector<std::string> ret; |
| 323 for (const auto& kv : transports_) { | 323 for (const auto& kv : transports_) { |
| 324 ret.push_back(kv.first); | 324 ret.push_back(kv.first); |
| 325 } | 325 } |
| 326 return ret; | 326 return ret; |
| 327 } | 327 } |
| 328 | 328 |
| 329 std::vector<TransportChannelImpl*> TransportController::channels_for_testing() { | 329 std::vector<DtlsTransportInternal*> |
| 330 std::vector<TransportChannelImpl*> ret; | 330 TransportController::channels_for_testing() { |
| 331 std::vector<DtlsTransportInternal*> ret; |
| 331 for (RefCountedChannel* channel : channels_) { | 332 for (RefCountedChannel* channel : channels_) { |
| 332 ret.push_back(channel->dtls()); | 333 ret.push_back(channel->dtls()); |
| 333 } | 334 } |
| 334 return ret; | 335 return ret; |
| 335 } | 336 } |
| 336 | 337 |
| 337 TransportChannelImpl* TransportController::get_channel_for_testing( | 338 DtlsTransportInternal* TransportController::get_channel_for_testing( |
| 338 const std::string& transport_name, | 339 const std::string& transport_name, |
| 339 int component) { | 340 int component) { |
| 340 RefCountedChannel* ch = GetChannel_n(transport_name, component); | 341 RefCountedChannel* ch = GetChannel_n(transport_name, component); |
| 341 return ch ? ch->dtls() : nullptr; | 342 return ch ? ch->dtls() : nullptr; |
| 342 } | 343 } |
| 343 | 344 |
| 344 TransportChannelImpl* TransportController::CreateIceTransportChannel_n( | 345 TransportChannelImpl* TransportController::CreateIceTransportChannel_n( |
| 345 const std::string& transport_name, | 346 const std::string& transport_name, |
| 346 int component) { | 347 int component) { |
| 347 return new P2PTransportChannel(transport_name, component, port_allocator_); | 348 return new P2PTransportChannel(transport_name, component, port_allocator_); |
| 348 } | 349 } |
| 349 | 350 |
| 350 TransportChannelImpl* TransportController::CreateDtlsTransportChannel_n( | 351 DtlsTransportInternal* TransportController::CreateDtlsTransportChannel_n( |
| 351 const std::string&, | 352 const std::string&, |
| 352 int, | 353 int, |
| 353 TransportChannelImpl* ice) { | 354 TransportChannelImpl* ice) { |
| 354 DtlsTransportChannelWrapper* dtls = new DtlsTransportChannelWrapper(ice); | 355 DtlsTransportChannelWrapper* dtls = new DtlsTransportChannelWrapper(ice); |
| 355 dtls->SetSslMaxProtocolVersion(ssl_max_version_); | 356 dtls->SetSslMaxProtocolVersion(ssl_max_version_); |
| 356 return dtls; | 357 return dtls; |
| 357 } | 358 } |
| 358 | 359 |
| 359 void TransportController::OnMessage(rtc::Message* pmsg) { | 360 void TransportController::OnMessage(rtc::Message* pmsg) { |
| 360 RTC_DCHECK(signaling_thread_->IsCurrent()); | 361 RTC_DCHECK(signaling_thread_->IsCurrent()); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 | 483 |
| 483 ssl_max_version_ = version; | 484 ssl_max_version_ = version; |
| 484 return true; | 485 return true; |
| 485 } | 486 } |
| 486 | 487 |
| 487 void TransportController::SetIceConfig_n(const IceConfig& config) { | 488 void TransportController::SetIceConfig_n(const IceConfig& config) { |
| 488 RTC_DCHECK(network_thread_->IsCurrent()); | 489 RTC_DCHECK(network_thread_->IsCurrent()); |
| 489 | 490 |
| 490 ice_config_ = config; | 491 ice_config_ = config; |
| 491 for (auto& channel : channels_) { | 492 for (auto& channel : channels_) { |
| 492 channel->dtls()->SetIceConfig(ice_config_); | 493 channel->dtls()->ice_transport()->SetIceConfig(ice_config_); |
| 493 } | 494 } |
| 494 } | 495 } |
| 495 | 496 |
| 496 void TransportController::SetIceRole_n(IceRole ice_role) { | 497 void TransportController::SetIceRole_n(IceRole ice_role) { |
| 497 RTC_DCHECK(network_thread_->IsCurrent()); | 498 RTC_DCHECK(network_thread_->IsCurrent()); |
| 498 | 499 |
| 499 ice_role_ = ice_role; | 500 ice_role_ = ice_role; |
| 500 for (auto& channel : channels_) { | 501 for (auto& channel : channels_) { |
| 501 channel->dtls()->SetIceRole(ice_role_); | 502 channel->dtls()->ice_transport()->SetIceRole(ice_role_); |
| 502 } | 503 } |
| 503 } | 504 } |
| 504 | 505 |
| 505 bool TransportController::GetSslRole_n(const std::string& transport_name, | 506 bool TransportController::GetSslRole_n(const std::string& transport_name, |
| 506 rtc::SSLRole* role) const { | 507 rtc::SSLRole* role) const { |
| 507 RTC_DCHECK(network_thread_->IsCurrent()); | 508 RTC_DCHECK(network_thread_->IsCurrent()); |
| 508 | 509 |
| 509 const JsepTransport* t = GetJsepTransport(transport_name); | 510 const JsepTransport* t = GetJsepTransport(transport_name); |
| 510 if (!t) { | 511 if (!t) { |
| 511 return false; | 512 return false; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 // description on a deleted transport. | 624 // description on a deleted transport. |
| 624 return true; | 625 return true; |
| 625 } | 626 } |
| 626 | 627 |
| 627 LOG(LS_INFO) << "Set remote transport description on " << transport_name; | 628 LOG(LS_INFO) << "Set remote transport description on " << transport_name; |
| 628 return transport->SetRemoteTransportDescription(tdesc, action, err); | 629 return transport->SetRemoteTransportDescription(tdesc, action, err); |
| 629 } | 630 } |
| 630 | 631 |
| 631 void TransportController::MaybeStartGathering_n() { | 632 void TransportController::MaybeStartGathering_n() { |
| 632 for (auto& channel : channels_) { | 633 for (auto& channel : channels_) { |
| 633 channel->dtls()->MaybeStartGathering(); | 634 channel->dtls()->ice_transport()->MaybeStartGathering(); |
| 634 } | 635 } |
| 635 } | 636 } |
| 636 | 637 |
| 637 bool TransportController::AddRemoteCandidates_n( | 638 bool TransportController::AddRemoteCandidates_n( |
| 638 const std::string& transport_name, | 639 const std::string& transport_name, |
| 639 const Candidates& candidates, | 640 const Candidates& candidates, |
| 640 std::string* err) { | 641 std::string* err) { |
| 641 RTC_DCHECK(network_thread_->IsCurrent()); | 642 RTC_DCHECK(network_thread_->IsCurrent()); |
| 642 | 643 |
| 643 // Verify each candidate before passing down to the transport layer. | 644 // Verify each candidate before passing down to the transport layer. |
| 644 if (!VerifyCandidates(candidates, err)) { | 645 if (!VerifyCandidates(candidates, err)) { |
| 645 return false; | 646 return false; |
| 646 } | 647 } |
| 647 | 648 |
| 648 JsepTransport* transport = GetJsepTransport(transport_name); | 649 JsepTransport* transport = GetJsepTransport(transport_name); |
| 649 if (!transport) { | 650 if (!transport) { |
| 650 // If we didn't find a transport, that's not an error; | 651 // If we didn't find a transport, that's not an error; |
| 651 // it could have been deleted as a result of bundling. | 652 // it could have been deleted as a result of bundling. |
| 652 return true; | 653 return true; |
| 653 } | 654 } |
| 654 | 655 |
| 655 for (const Candidate& candidate : candidates) { | 656 for (const Candidate& candidate : candidates) { |
| 656 RefCountedChannel* channel = | 657 RefCountedChannel* channel = |
| 657 GetChannel_n(transport_name, candidate.component()); | 658 GetChannel_n(transport_name, candidate.component()); |
| 658 if (!channel) { | 659 if (!channel) { |
| 659 *err = "Candidate has an unknown component: " + candidate.ToString() + | 660 *err = "Candidate has an unknown component: " + candidate.ToString() + |
| 660 " for content: " + transport_name; | 661 " for content: " + transport_name; |
| 661 return false; | 662 return false; |
| 662 } | 663 } |
| 663 channel->dtls()->AddRemoteCandidate(candidate); | 664 channel->dtls()->ice_transport()->AddRemoteCandidate(candidate); |
| 664 } | 665 } |
| 665 return true; | 666 return true; |
| 666 } | 667 } |
| 667 | 668 |
| 668 bool TransportController::RemoveRemoteCandidates_n(const Candidates& candidates, | 669 bool TransportController::RemoveRemoteCandidates_n(const Candidates& candidates, |
| 669 std::string* err) { | 670 std::string* err) { |
| 670 RTC_DCHECK(network_thread_->IsCurrent()); | 671 RTC_DCHECK(network_thread_->IsCurrent()); |
| 671 | 672 |
| 672 // Verify each candidate before passing down to the transport layer. | 673 // Verify each candidate before passing down to the transport layer. |
| 673 if (!VerifyCandidates(candidates, err)) { | 674 if (!VerifyCandidates(candidates, err)) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 687 JsepTransport* transport = GetJsepTransport(transport_name); | 688 JsepTransport* transport = GetJsepTransport(transport_name); |
| 688 if (!transport) { | 689 if (!transport) { |
| 689 // If we didn't find a transport, that's not an error; | 690 // If we didn't find a transport, that's not an error; |
| 690 // it could have been deleted as a result of bundling. | 691 // it could have been deleted as a result of bundling. |
| 691 continue; | 692 continue; |
| 692 } | 693 } |
| 693 for (const Candidate& candidate : candidates) { | 694 for (const Candidate& candidate : candidates) { |
| 694 RefCountedChannel* channel = | 695 RefCountedChannel* channel = |
| 695 GetChannel_n(transport_name, candidate.component()); | 696 GetChannel_n(transport_name, candidate.component()); |
| 696 if (channel) { | 697 if (channel) { |
| 697 channel->dtls()->RemoveRemoteCandidate(candidate); | 698 channel->dtls()->ice_transport()->RemoveRemoteCandidate(candidate); |
| 698 } | 699 } |
| 699 } | 700 } |
| 700 } | 701 } |
| 701 return result; | 702 return result; |
| 702 } | 703 } |
| 703 | 704 |
| 704 bool TransportController::ReadyForRemoteCandidates_n( | 705 bool TransportController::ReadyForRemoteCandidates_n( |
| 705 const std::string& transport_name) const { | 706 const std::string& transport_name) const { |
| 706 RTC_DCHECK(network_thread_->IsCurrent()); | 707 RTC_DCHECK(network_thread_->IsCurrent()); |
| 707 | 708 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 721 return false; | 722 return false; |
| 722 } | 723 } |
| 723 return transport->GetStats(stats); | 724 return transport->GetStats(stats); |
| 724 } | 725 } |
| 725 | 726 |
| 726 void TransportController::SetMetricsObserver_n( | 727 void TransportController::SetMetricsObserver_n( |
| 727 webrtc::MetricsObserverInterface* metrics_observer) { | 728 webrtc::MetricsObserverInterface* metrics_observer) { |
| 728 RTC_DCHECK(network_thread_->IsCurrent()); | 729 RTC_DCHECK(network_thread_->IsCurrent()); |
| 729 metrics_observer_ = metrics_observer; | 730 metrics_observer_ = metrics_observer; |
| 730 for (auto& channel : channels_) { | 731 for (auto& channel : channels_) { |
| 731 channel->dtls()->SetMetricsObserver(metrics_observer); | 732 channel->dtls()->ice_transport()->SetMetricsObserver(metrics_observer); |
| 732 } | 733 } |
| 733 } | 734 } |
| 734 | 735 |
| 735 void TransportController::OnChannelWritableState_n( | 736 void TransportController::OnChannelWritableState_n( |
| 736 rtc::PacketTransportInterface* transport) { | 737 rtc::PacketTransportInterface* transport) { |
| 737 RTC_DCHECK(network_thread_->IsCurrent()); | 738 RTC_DCHECK(network_thread_->IsCurrent()); |
| 738 LOG(LS_INFO) << " TransportChannel " << transport->debug_name() | 739 LOG(LS_INFO) << " TransportChannel " << transport->debug_name() |
| 739 << " writability changed to " << transport->writable() << "."; | 740 << " writability changed to " << transport->writable() << "."; |
| 740 UpdateAggregateStates_n(); | 741 UpdateAggregateStates_n(); |
| 741 } | 742 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 IceConnectionState new_connection_state = kIceConnectionConnecting; | 816 IceConnectionState new_connection_state = kIceConnectionConnecting; |
| 816 IceGatheringState new_gathering_state = kIceGatheringNew; | 817 IceGatheringState new_gathering_state = kIceGatheringNew; |
| 817 bool any_receiving = false; | 818 bool any_receiving = false; |
| 818 bool any_failed = false; | 819 bool any_failed = false; |
| 819 bool all_connected = !channels_.empty(); | 820 bool all_connected = !channels_.empty(); |
| 820 bool all_completed = !channels_.empty(); | 821 bool all_completed = !channels_.empty(); |
| 821 bool any_gathering = false; | 822 bool any_gathering = false; |
| 822 bool all_done_gathering = !channels_.empty(); | 823 bool all_done_gathering = !channels_.empty(); |
| 823 for (const auto& channel : channels_) { | 824 for (const auto& channel : channels_) { |
| 824 any_receiving = any_receiving || channel->dtls()->receiving(); | 825 any_receiving = any_receiving || channel->dtls()->receiving(); |
| 825 any_failed = | 826 any_failed = any_failed || |
| 826 any_failed || | 827 channel->dtls()->ice_transport()->GetState() == |
| 827 channel->dtls()->GetState() == TransportChannelState::STATE_FAILED; | 828 TransportChannelState::STATE_FAILED; |
| 828 all_connected = all_connected && channel->dtls()->writable(); | 829 all_connected = all_connected && channel->dtls()->writable(); |
| 829 all_completed = | 830 all_completed = |
| 830 all_completed && channel->dtls()->writable() && | 831 all_completed && channel->dtls()->writable() && |
| 831 channel->dtls()->GetState() == TransportChannelState::STATE_COMPLETED && | 832 channel->dtls()->ice_transport()->GetState() == |
| 832 channel->dtls()->GetIceRole() == ICEROLE_CONTROLLING && | 833 TransportChannelState::STATE_COMPLETED && |
| 833 channel->dtls()->gathering_state() == kIceGatheringComplete; | 834 channel->dtls()->ice_transport()->GetIceRole() == ICEROLE_CONTROLLING && |
| 835 channel->dtls()->ice_transport()->gathering_state() == |
| 836 kIceGatheringComplete; |
| 834 any_gathering = | 837 any_gathering = |
| 835 any_gathering || channel->dtls()->gathering_state() != kIceGatheringNew; | 838 any_gathering || |
| 836 all_done_gathering = | 839 channel->dtls()->ice_transport()->gathering_state() != kIceGatheringNew; |
| 837 all_done_gathering && | 840 all_done_gathering = all_done_gathering && |
| 838 channel->dtls()->gathering_state() == kIceGatheringComplete; | 841 channel->dtls()->ice_transport()->gathering_state() == |
| 842 kIceGatheringComplete; |
| 839 } | 843 } |
| 840 | |
| 841 if (any_failed) { | 844 if (any_failed) { |
| 842 new_connection_state = kIceConnectionFailed; | 845 new_connection_state = kIceConnectionFailed; |
| 843 } else if (all_completed) { | 846 } else if (all_completed) { |
| 844 new_connection_state = kIceConnectionCompleted; | 847 new_connection_state = kIceConnectionCompleted; |
| 845 } else if (all_connected) { | 848 } else if (all_connected) { |
| 846 new_connection_state = kIceConnectionConnected; | 849 new_connection_state = kIceConnectionConnected; |
| 847 } | 850 } |
| 848 if (connection_state_ != new_connection_state) { | 851 if (connection_state_ != new_connection_state) { |
| 849 connection_state_ = new_connection_state; | 852 connection_state_ = new_connection_state; |
| 850 signaling_thread_->Post( | 853 signaling_thread_->Post( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 869 RTC_FROM_HERE, this, MSG_ICEGATHERINGSTATE, | 872 RTC_FROM_HERE, this, MSG_ICEGATHERINGSTATE, |
| 870 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); | 873 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); |
| 871 } | 874 } |
| 872 } | 875 } |
| 873 | 876 |
| 874 void TransportController::OnDtlsHandshakeError(rtc::SSLHandshakeError error) { | 877 void TransportController::OnDtlsHandshakeError(rtc::SSLHandshakeError error) { |
| 875 SignalDtlsHandshakeError(error); | 878 SignalDtlsHandshakeError(error); |
| 876 } | 879 } |
| 877 | 880 |
| 878 } // namespace cricket | 881 } // namespace cricket |
| OLD | NEW |