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

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

Issue 2171183002: Remove ports that are not used by any channel after timeout (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: fix a comment Created 4 years, 5 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
Index: webrtc/p2p/base/p2ptransportchannel.cc
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
index 5238da83ca9302954e00b4a5204fc5121eda6851..d37e736b401e0de99abec1cc9fb87dd57e6653d0 100644
--- a/webrtc/p2p/base/p2ptransportchannel.cc
+++ b/webrtc/p2p/base/p2ptransportchannel.cc
@@ -145,14 +145,16 @@ void P2PTransportChannel::AddAllocatorSession(
this, &P2PTransportChannel::OnCandidatesRemoved);
session->SignalCandidatesAllocationDone.connect(
this, &P2PTransportChannel::OnCandidatesAllocationDone);
+ allocator_sessions_.push_back(std::move(session));
// 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.
+ for (PortInterface* port : ports_) {
+ port->StopBeingUsed();
+ }
pthatcher1 2016/07/27 18:33:15 for (PortAllocatorSession session : allocator_sess
honghaiz3 2016/07/28 01:22:49 Done. Only need to do the last one.
removed_ports_.insert(removed_ports_.end(), ports_.begin(), ports_.end());
ports_.clear();
pthatcher1 2016/07/27 18:33:15 Can we move this into a method called RemoveAllPor
honghaiz3 2016/07/28 01:22:49 You suggested a different name in another pending
-
- allocator_sessions_.push_back(std::move(session));
}
void P2PTransportChannel::AddConnection(Connection* connection) {
@@ -471,6 +473,7 @@ void P2PTransportChannel::OnPortReady(PortAllocatorSession *session,
port->SetIceRole(ice_role_);
port->SetIceTiebreaker(tiebreaker_);
+ port->StartBeingUsed();
pthatcher1 2016/07/27 18:33:15 Like we mentioned in person, I think this could ei
honghaiz3 2016/07/28 01:22:49 Done.
ports_.push_back(port);
port->SignalUnknownAddress.connect(
this, &P2PTransportChannel::OnUnknownAddress);
@@ -1746,6 +1749,7 @@ bool P2PTransportChannel::RemovePort(PortInterface* port) {
}
ports_.erase(it);
removed_ports_.push_back(port);
+ port->StopBeingUsed();
pthatcher1 2016/07/27 18:33:15 Like we talked about in person, having this be Por
honghaiz3 2016/07/28 01:22:49 Done.
return true;
}

Powered by Google App Engine
This is Rietveld 408576698