OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1245 if (iter != pings_since_last_response_.end() && | 1245 if (iter != pings_since_last_response_.end() && |
1246 iter->nomination > acked_nomination_) { | 1246 iter->nomination > acked_nomination_) { |
1247 acked_nomination_ = iter->nomination; | 1247 acked_nomination_ = iter->nomination; |
1248 } | 1248 } |
1249 | 1249 |
1250 pings_since_last_response_.clear(); | 1250 pings_since_last_response_.clear(); |
1251 last_ping_response_received_ = rtc::TimeMillis(); | 1251 last_ping_response_received_ = rtc::TimeMillis(); |
1252 UpdateReceiving(last_ping_response_received_); | 1252 UpdateReceiving(last_ping_response_received_); |
1253 set_write_state(STATE_WRITABLE); | 1253 set_write_state(STATE_WRITABLE); |
1254 set_state(IceCandidatePairState::SUCCEEDED); | 1254 set_state(IceCandidatePairState::SUCCEEDED); |
1255 if (rtt_samples_ > 0) { | |
1256 rtt_ = (RTT_RATIO * rtt_ + rtt) / (RTT_RATIO + 1); | |
1257 } else { | |
1258 rtt_ = rtt; | |
Taylor Brandstetter
2017/02/02 18:07:41
May make more sense in a separate CL, but it would
pthatcher2
2017/02/02 20:09:44
I agree that we should split it into "smoothed_rtt
skvlad
2017/02/02 22:19:33
Let's make it rtc::Optional in a separate CL. Ther
| |
1259 } | |
1255 rtt_samples_++; | 1260 rtt_samples_++; |
1256 rtt_ = (RTT_RATIO * rtt_ + rtt) / (RTT_RATIO + 1); | |
1257 } | 1261 } |
1258 | 1262 |
1259 bool Connection::dead(int64_t now) const { | 1263 bool Connection::dead(int64_t now) const { |
1260 if (last_received() > 0) { | 1264 if (last_received() > 0) { |
1261 // If it has ever received anything, we keep it alive until it hasn't | 1265 // If it has ever received anything, we keep it alive until it hasn't |
1262 // received anything for DEAD_CONNECTION_RECEIVE_TIMEOUT. This covers the | 1266 // received anything for DEAD_CONNECTION_RECEIVE_TIMEOUT. This covers the |
1263 // normal case of a successfully used connection that stops working. This | 1267 // normal case of a successfully used connection that stops working. This |
1264 // also allows a remote peer to continue pinging over a locally inactive | 1268 // also allows a remote peer to continue pinging over a locally inactive |
1265 // (pruned) connection. | 1269 // (pruned) connection. |
1266 return (now > (last_received() + DEAD_CONNECTION_RECEIVE_TIMEOUT)); | 1270 return (now > (last_received() + DEAD_CONNECTION_RECEIVE_TIMEOUT)); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1583 RTC_DCHECK(sent < 0); | 1587 RTC_DCHECK(sent < 0); |
1584 error_ = port_->GetError(); | 1588 error_ = port_->GetError(); |
1585 stats_.sent_discarded_packets++; | 1589 stats_.sent_discarded_packets++; |
1586 } else { | 1590 } else { |
1587 send_rate_tracker_.AddSamples(sent); | 1591 send_rate_tracker_.AddSamples(sent); |
1588 } | 1592 } |
1589 return sent; | 1593 return sent; |
1590 } | 1594 } |
1591 | 1595 |
1592 } // namespace cricket | 1596 } // namespace cricket |
OLD | NEW |