Index: webrtc/p2p/base/p2ptransportchannel.cc |
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc |
index 7f16b3a1d53f9dccf11b2290ca1703b6460af0f1..206113c4ebcc554d9b401e716c5031412eda4845 100644 |
--- a/webrtc/p2p/base/p2ptransportchannel.cc |
+++ b/webrtc/p2p/base/p2ptransportchannel.cc |
@@ -217,8 +217,10 @@ |
// writable or not receiving. |
const int WEAK_PING_INTERVAL = 1000 * PING_PACKET_SIZE / 10000; |
-// Writable connections are pinged at a slower rate. |
-static const int WRITABLE_CONNECTION_PING_INTERVAL = 2500; // ms |
+// If the current best connection is both writable and receiving, then we will |
+// also try hard to make sure it is pinged at this rate (a little less than |
+// 2 * STRONG_PING_INTERVAL). |
+static const int MAX_CURRENT_STRONG_INTERVAL = 900; // ms |
static const int MIN_CHECK_RECEIVING_INTERVAL = 50; // ms |
@@ -248,7 +250,7 @@ |
0 /* backup_connection_ping_interval */, |
false /* gather_continually */, |
false /* prioritize_most_likely_candidate_pairs */, |
- WRITABLE_CONNECTION_PING_INTERVAL) { |
+ MAX_CURRENT_STRONG_INTERVAL /* max_strong_interval */) { |
uint32_t weak_ping_interval = ::strtoul( |
webrtc::field_trial::FindFullName("WebRTC-StunInterPacketDelay").c_str(), |
nullptr, 10); |
@@ -434,13 +436,11 @@ |
LOG(LS_INFO) << "Set ping most likely connection to " |
<< config_.prioritize_most_likely_candidate_pairs; |
- if (config.writable_connection_ping_interval >= 0 && |
- config_.writable_connection_ping_interval != |
- config.writable_connection_ping_interval) { |
- config_.writable_connection_ping_interval = |
- config.writable_connection_ping_interval; |
- LOG(LS_INFO) << "Set writable_connection_ping_interval to " |
- << config_.writable_connection_ping_interval; |
+ if (config.max_strong_interval >= 0 && |
+ config_.max_strong_interval != config.max_strong_interval) { |
+ config_.max_strong_interval = config.max_strong_interval; |
+ LOG(LS_INFO) << "Set max strong interval to " |
+ << config_.max_strong_interval; |
} |
} |
@@ -1291,7 +1291,6 @@ |
MarkConnectionPinged(conn); |
} |
} |
- |
int delay = std::min(ping_interval, check_receiving_interval_); |
thread()->PostDelayed(delay, this, MSG_CHECK_AND_PING); |
} |
@@ -1333,13 +1332,6 @@ |
return (now >= conn->last_ping_response_received() + |
config_.backup_connection_ping_interval); |
} |
- |
- // Writable connections are pinged at a slower rate. |
- if (conn->writable()) { |
- return (now >= |
- conn->last_ping_sent() + config_.writable_connection_ping_interval); |
- } |
- |
return conn->active(); |
} |
@@ -1355,8 +1347,7 @@ |
Connection* conn_to_ping = nullptr; |
if (best_connection_ && best_connection_->connected() && |
best_connection_->writable() && |
- (best_connection_->last_ping_sent() + |
- config_.writable_connection_ping_interval <= |
+ (best_connection_->last_ping_sent() + config_.max_strong_interval <= |
now)) { |
conn_to_ping = best_connection_; |
} else { |