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

Side by Side Diff: webrtc/p2p/base/transportcontroller.cc

Issue 2004463003: Handle any number of role conflicts; not just the first. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/transportcontroller.h ('k') | webrtc/p2p/base/transportcontroller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 569
570 void TransportController::OnChannelCandidatesRemoved( 570 void TransportController::OnChannelCandidatesRemoved(
571 const Candidates& candidates) { 571 const Candidates& candidates) {
572 RTC_DCHECK(signaling_thread_->IsCurrent()); 572 RTC_DCHECK(signaling_thread_->IsCurrent());
573 SignalCandidatesRemoved(candidates); 573 SignalCandidatesRemoved(candidates);
574 } 574 }
575 575
576 void TransportController::OnChannelRoleConflict_n( 576 void TransportController::OnChannelRoleConflict_n(
577 TransportChannelImpl* channel) { 577 TransportChannelImpl* channel) {
578 RTC_DCHECK(network_thread_->IsCurrent()); 578 RTC_DCHECK(network_thread_->IsCurrent());
579 579 // Note: since the role conflict is handled entirely on the network thread,
580 if (ice_role_switch_) { 580 // we don't need to worry about role conflicts occurring on two ports at once.
581 LOG(LS_WARNING) 581 // The first one encountered should immediately reverse the role.
582 << "Repeat of role conflict signal from TransportChannelImpl.";
583 return;
584 }
585
586 ice_role_switch_ = true;
587 IceRole reversed_role = (ice_role_ == ICEROLE_CONTROLLING) 582 IceRole reversed_role = (ice_role_ == ICEROLE_CONTROLLING)
588 ? ICEROLE_CONTROLLED 583 ? ICEROLE_CONTROLLED
589 : ICEROLE_CONTROLLING; 584 : ICEROLE_CONTROLLING;
590 for (const auto& kv : transports_) { 585 LOG(LS_INFO) << "Got role conflict; switching to "
591 kv.second->SetIceRole(reversed_role); 586 << (reversed_role == ICEROLE_CONTROLLING ? "controlling"
592 } 587 : "controlled")
588 << " role.";
589 SetIceRole_n(reversed_role);
593 } 590 }
594 591
595 void TransportController::OnChannelConnectionRemoved_n( 592 void TransportController::OnChannelConnectionRemoved_n(
596 TransportChannelImpl* channel) { 593 TransportChannelImpl* channel) {
597 RTC_DCHECK(network_thread_->IsCurrent()); 594 RTC_DCHECK(network_thread_->IsCurrent());
598 LOG(LS_INFO) << channel->transport_name() << " TransportChannel " 595 LOG(LS_INFO) << channel->transport_name() << " TransportChannel "
599 << channel->component() 596 << channel->component()
600 << " connection removed. Check if state is complete."; 597 << " connection removed. Check if state is complete.";
601 UpdateAggregateStates_n(); 598 UpdateAggregateStates_n();
602 } 599 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } 652 }
656 if (gathering_state_ != new_gathering_state) { 653 if (gathering_state_ != new_gathering_state) {
657 gathering_state_ = new_gathering_state; 654 gathering_state_ = new_gathering_state;
658 signaling_thread_->Post( 655 signaling_thread_->Post(
659 this, MSG_ICEGATHERINGSTATE, 656 this, MSG_ICEGATHERINGSTATE,
660 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); 657 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state));
661 } 658 }
662 } 659 }
663 660
664 } // namespace cricket 661 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transportcontroller.h ('k') | webrtc/p2p/base/transportcontroller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698