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

Unified Diff: webrtc/p2p/client/basicportallocator.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: . 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
« no previous file with comments | « webrtc/p2p/client/basicportallocator.h ('k') | webrtc/p2p/client/basicportallocator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/client/basicportallocator.cc
diff --git a/webrtc/p2p/client/basicportallocator.cc b/webrtc/p2p/client/basicportallocator.cc
index 46c28926c8db4e5ce844d0de6e6d268a589aaed2..658bac3e88f76114525c0afa044575551b4df31c 100644
--- a/webrtc/p2p/client/basicportallocator.cc
+++ b/webrtc/p2p/client/basicportallocator.cc
@@ -706,6 +706,7 @@ void BasicPortAllocatorSession::OnCandidateReady(
if (!data->pruned()) {
LOG_J(LS_INFO, port) << "Port ready.";
SignalPortReady(this, port);
+ port->KeepAliveUntilPruned();
}
}
@@ -761,6 +762,7 @@ bool BasicPortAllocatorSession::PruneTurnPorts(Port* newly_pairable_turn_port) {
ComparePort(data.port(), best_turn_port) < 0) {
data.set_pruned();
pruned = true;
+ data.port()->Prune();
if (data.port() != newly_pairable_turn_port) {
pruned_ports.push_back(data.port());
}
@@ -773,6 +775,12 @@ bool BasicPortAllocatorSession::PruneTurnPorts(Port* newly_pairable_turn_port) {
return pruned;
}
+void BasicPortAllocatorSession::PruneAllPorts() {
+ for (PortData& data : ports_) {
+ data.port()->Prune();
+ }
+}
+
void BasicPortAllocatorSession::OnPortComplete(Port* port) {
ASSERT(rtc::Thread::Current() == network_thread_);
LOG_J(LS_INFO, port) << "Port completed gathering candidates.";
@@ -942,6 +950,8 @@ void BasicPortAllocatorSession::RemovePortsAndCandidates(
data.sequence()->network()) == networks.end()) {
continue;
}
+ // Prune the port so that it may be destroyed.
+ data.port()->Prune();
ports_to_remove.push_back(data.port());
if (data.has_pairable_candidate()) {
GetCandidatesFromPort(data, &candidates_to_remove);
« no previous file with comments | « webrtc/p2p/client/basicportallocator.h ('k') | webrtc/p2p/client/basicportallocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698