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

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

Issue 1364683002: Do not prune if the current best connection is weak. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Add tests and merge Created 5 years, 3 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 e7f5c941c403825362799f9fe82bcc44ecf1a196..c36cd7a8f98019ac5dfe0d8567f6af61a4809c83 100644
--- a/webrtc/p2p/base/p2ptransportchannel.cc
+++ b/webrtc/p2p/base/p2ptransportchannel.cc
@@ -975,7 +975,7 @@ void P2PTransportChannel::PruneConnections() {
// which point, we would prune out the current best connection). We leave
// connections on other networks because they may not be using the same
// resources and they may represent very distinct paths over which we can
- // switch. If the |primier| connection is not connected, we may be
+ // switch. If the |premier| connection is not connected, we may be
// reconnecting a TCP connection and temporarily do not prune connections in
// this network. See the big comment in CompareConnections.
@@ -985,14 +985,16 @@ void P2PTransportChannel::PruneConnections() {
networks.insert(conn->port()->Network());
}
for (rtc::Network* network : networks) {
- Connection* primier = GetBestConnectionOnNetwork(network);
- if (!(primier && primier->writable() && primier->connected())) {
+ Connection* premier = GetBestConnectionOnNetwork(network);
+ // Do not prune connections if the current best connection is weak on this
+ // network. Otherwise, it may delete connections prematurely.
+ if (!premier || premier->Weak()) {
continue;
}
for (Connection* conn : connections_) {
- if ((conn != primier) && (conn->port()->Network() == network) &&
- (CompareConnectionCandidates(primier, conn) >= 0)) {
+ if ((conn != premier) && (conn->port()->Network() == network) &&
+ (CompareConnectionCandidates(premier, conn) >= 0)) {
conn->Prune();
}
}
« no previous file with comments | « no previous file | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698