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

Unified Diff: webrtc/p2p/base/p2ptransportchannel.cc

Issue 2078423004: Revert of Update ICE role on all ports, not just ones used for new connections. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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/p2ptransportchannel.h ('k') | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/p2ptransportchannel.cc
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
index 1d02689960994c7a674ce96ab584b49729dcb815..fc1f0a4e6769ee96ce28f851d0f7cbc368fbf69c 100644
--- a/webrtc/p2p/base/p2ptransportchannel.cc
+++ b/webrtc/p2p/base/p2ptransportchannel.cc
@@ -279,7 +279,6 @@
// We now only want to apply new candidates that we receive to the ports
// created by this new session because these are replacing those of the
// previous sessions.
- removed_ports_.insert(removed_ports_.end(), ports_.begin(), ports_.end());
ports_.clear();
allocator_sessions_.push_back(std::move(session));
@@ -306,20 +305,16 @@
ASSERT(worker_thread_ == rtc::Thread::Current());
if (ice_role_ != ice_role) {
ice_role_ = ice_role;
- for (PortInterface* port : ports_) {
- port->SetIceRole(ice_role);
- }
- // Update role on removed ports as well, because they may still have
- // connections alive that should be using the correct role.
- for (PortInterface* port : removed_ports_) {
- port->SetIceRole(ice_role);
+ for (std::vector<PortInterface *>::iterator it = ports_.begin();
+ it != ports_.end(); ++it) {
+ (*it)->SetIceRole(ice_role);
}
}
}
void P2PTransportChannel::SetIceTiebreaker(uint64_t tiebreaker) {
ASSERT(worker_thread_ == rtc::Thread::Current());
- if (!ports_.empty() || !removed_ports_.empty()) {
+ if (!ports_.empty()) {
LOG(LS_ERROR)
<< "Attempt to change tiebreaker after Port has been allocated.";
return;
@@ -972,13 +967,13 @@
it->second = value;
}
- for (PortInterface* port : ports_) {
- int val = port->SetOption(opt, value);
+ for (size_t i = 0; i < ports_.size(); ++i) {
+ int val = ports_[i]->SetOption(opt, value);
if (val < 0) {
// Because this also occurs deferred, probably no point in reporting an
// error
- LOG(WARNING) << "SetOption(" << opt << ", " << value
- << ") failed: " << port->GetError();
+ LOG(WARNING) << "SetOption(" << opt << ", " << value << ") failed: "
+ << ports_[i]->GetError();
}
}
return 0;
@@ -1518,9 +1513,10 @@
ASSERT(worker_thread_ == rtc::Thread::Current());
// Remove this port from the list (if we didn't drop it already).
- ports_.erase(std::remove(ports_.begin(), ports_.end(), port));
- removed_ports_.erase(
- std::remove(removed_ports_.begin(), removed_ports_.end(), port));
+ std::vector<PortInterface*>::iterator iter =
+ std::find(ports_.begin(), ports_.end(), port);
+ if (iter != ports_.end())
+ ports_.erase(iter);
LOG(INFO) << "Removed port from p2p socket: "
<< static_cast<int>(ports_.size()) << " remaining";
@@ -1537,7 +1533,6 @@
if (it == ports_.end()) {
return;
}
- removed_ports_.push_back(*it);
ports_.erase(it);
LOG(INFO) << "Removed port due to inactive networks: " << ports_.size()
<< " remaining";
« no previous file with comments | « webrtc/p2p/base/p2ptransportchannel.h ('k') | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698