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

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: Change the test name 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
« no previous file with comments | « no previous file | 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 cd1af82c8d59365a47af2647869680ae6c98c20c..2a851f5c7259cf32c22d66b149b8e059249ed939 100644
--- a/webrtc/p2p/base/p2ptransportchannel.cc
+++ b/webrtc/p2p/base/p2ptransportchannel.cc
@@ -1000,7 +1000,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.
@@ -1010,14 +1010,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();
}
}
@@ -1092,8 +1094,7 @@ void P2PTransportChannel::HandleAllTimedOut() {
}
bool P2PTransportChannel::Weak() const {
- return !(best_connection_ && best_connection_->receiving() &&
- best_connection_->writable());
+ return !best_connection_ || best_connection_->Weak();
}
// If we have a best connection, return it, otherwise return top one in the
« no previous file with comments | « no previous file | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698