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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/transportcontroller.cc
diff --git a/webrtc/p2p/base/transportcontroller.cc b/webrtc/p2p/base/transportcontroller.cc
index a961541dc3e9e4dd1ac2b1655d126f1b1eee7566..fcf46e5d9d5a5430e2972dfa9d3638ae5c5c4e82 100644
--- a/webrtc/p2p/base/transportcontroller.cc
+++ b/webrtc/p2p/base/transportcontroller.cc
@@ -576,20 +576,17 @@ void TransportController::OnChannelCandidatesRemoved(
void TransportController::OnChannelRoleConflict_n(
TransportChannelImpl* channel) {
RTC_DCHECK(network_thread_->IsCurrent());
-
- if (ice_role_switch_) {
- LOG(LS_WARNING)
- << "Repeat of role conflict signal from TransportChannelImpl.";
- return;
- }
-
- ice_role_switch_ = true;
+ // Note: since the role conflict is handled entirely on the network thread,
+ // we don't need to worry about role conflicts occurring on two ports at once.
+ // The first one encountered should immediately reverse the role.
IceRole reversed_role = (ice_role_ == ICEROLE_CONTROLLING)
? ICEROLE_CONTROLLED
: ICEROLE_CONTROLLING;
- for (const auto& kv : transports_) {
- kv.second->SetIceRole(reversed_role);
- }
+ LOG(LS_INFO) << "Got role conflict; switching to "
+ << (reversed_role == ICEROLE_CONTROLLING ? "controlling"
+ : "controlled")
+ << " role.";
+ SetIceRole_n(reversed_role);
}
void TransportController::OnChannelConnectionRemoved_n(
« 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