OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/quic_connection.h" | 5 #include "net/quic/quic_connection.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 QuicFrame(new QuicWindowUpdateFrame(id, byte_offset))); | 1116 QuicFrame(new QuicWindowUpdateFrame(id, byte_offset))); |
1117 } | 1117 } |
1118 | 1118 |
1119 void QuicConnection::SendBlocked(QuicStreamId id) { | 1119 void QuicConnection::SendBlocked(QuicStreamId id) { |
1120 // Opportunistically bundle an ack with this outgoing packet. | 1120 // Opportunistically bundle an ack with this outgoing packet. |
1121 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); | 1121 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); |
1122 packet_generator_.AddControlFrame(QuicFrame(new QuicBlockedFrame(id))); | 1122 packet_generator_.AddControlFrame(QuicFrame(new QuicBlockedFrame(id))); |
1123 } | 1123 } |
1124 | 1124 |
1125 const QuicConnectionStats& QuicConnection::GetStats() { | 1125 const QuicConnectionStats& QuicConnection::GetStats() { |
1126 if (!FLAGS_quic_use_initial_rtt_for_stats) { | 1126 const RttStats* rtt_stats = sent_packet_manager_.GetRttStats(); |
1127 stats_.min_rtt_us = | |
1128 sent_packet_manager_.GetRttStats()->min_rtt().ToMicroseconds(); | |
1129 stats_.srtt_us = | |
1130 sent_packet_manager_.GetRttStats()->smoothed_rtt().ToMicroseconds(); | |
1131 } else { | |
1132 const RttStats* rtt_stats = sent_packet_manager_.GetRttStats(); | |
1133 | 1127 |
1134 // Update rtt and estimated bandwidth. | 1128 // Update rtt and estimated bandwidth. |
1135 QuicTime::Delta min_rtt = rtt_stats->min_rtt(); | 1129 QuicTime::Delta min_rtt = rtt_stats->min_rtt(); |
1136 if (min_rtt.IsZero()) { | 1130 if (min_rtt.IsZero()) { |
1137 // If min RTT has not been set, use initial RTT instead. | 1131 // If min RTT has not been set, use initial RTT instead. |
1138 min_rtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us()); | 1132 min_rtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us()); |
1139 } | 1133 } |
1140 stats_.min_rtt_us = min_rtt.ToMicroseconds(); | 1134 stats_.min_rtt_us = min_rtt.ToMicroseconds(); |
1141 | 1135 |
1142 QuicTime::Delta srtt = rtt_stats->smoothed_rtt(); | 1136 QuicTime::Delta srtt = rtt_stats->smoothed_rtt(); |
1143 if (srtt.IsZero()) { | 1137 if (srtt.IsZero()) { |
1144 // If SRTT has not been set, use initial RTT instead. | 1138 // If SRTT has not been set, use initial RTT instead. |
1145 srtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us()); | 1139 srtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us()); |
1146 } | |
1147 stats_.srtt_us = srtt.ToMicroseconds(); | |
1148 } | 1140 } |
| 1141 stats_.srtt_us = srtt.ToMicroseconds(); |
1149 | 1142 |
1150 stats_.estimated_bandwidth = sent_packet_manager_.BandwidthEstimate(); | 1143 stats_.estimated_bandwidth = sent_packet_manager_.BandwidthEstimate(); |
1151 stats_.max_packet_size = packet_generator_.max_packet_length(); | 1144 stats_.max_packet_size = packet_generator_.max_packet_length(); |
1152 return stats_; | 1145 return stats_; |
1153 } | 1146 } |
1154 | 1147 |
1155 void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address, | 1148 void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address, |
1156 const IPEndPoint& peer_address, | 1149 const IPEndPoint& peer_address, |
1157 const QuicEncryptedPacket& packet) { | 1150 const QuicEncryptedPacket& packet) { |
1158 if (!connected_) { | 1151 if (!connected_) { |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 } | 2110 } |
2118 for (const QuicFrame& frame : retransmittable_frames->frames()) { | 2111 for (const QuicFrame& frame : retransmittable_frames->frames()) { |
2119 if (frame.type == CONNECTION_CLOSE_FRAME) { | 2112 if (frame.type == CONNECTION_CLOSE_FRAME) { |
2120 return true; | 2113 return true; |
2121 } | 2114 } |
2122 } | 2115 } |
2123 return false; | 2116 return false; |
2124 } | 2117 } |
2125 | 2118 |
2126 } // namespace net | 2119 } // namespace net |
OLD | NEW |