| Index: net/quic/quic_connection.cc
|
| diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
|
| index 454a15b59b5780745b593b603b0c4c06aa0d8bf2..778d6d0c51ee5353784a053866bef381235e756e 100644
|
| --- a/net/quic/quic_connection.cc
|
| +++ b/net/quic/quic_connection.cc
|
| @@ -1123,29 +1123,22 @@ void QuicConnection::SendBlocked(QuicStreamId id) {
|
| }
|
|
|
| const QuicConnectionStats& QuicConnection::GetStats() {
|
| - if (!FLAGS_quic_use_initial_rtt_for_stats) {
|
| - stats_.min_rtt_us =
|
| - sent_packet_manager_.GetRttStats()->min_rtt().ToMicroseconds();
|
| - stats_.srtt_us =
|
| - sent_packet_manager_.GetRttStats()->smoothed_rtt().ToMicroseconds();
|
| - } else {
|
| - const RttStats* rtt_stats = sent_packet_manager_.GetRttStats();
|
| + const RttStats* rtt_stats = sent_packet_manager_.GetRttStats();
|
|
|
| - // Update rtt and estimated bandwidth.
|
| - QuicTime::Delta min_rtt = rtt_stats->min_rtt();
|
| - if (min_rtt.IsZero()) {
|
| - // If min RTT has not been set, use initial RTT instead.
|
| - min_rtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us());
|
| - }
|
| - stats_.min_rtt_us = min_rtt.ToMicroseconds();
|
| + // Update rtt and estimated bandwidth.
|
| + QuicTime::Delta min_rtt = rtt_stats->min_rtt();
|
| + if (min_rtt.IsZero()) {
|
| + // If min RTT has not been set, use initial RTT instead.
|
| + min_rtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us());
|
| + }
|
| + stats_.min_rtt_us = min_rtt.ToMicroseconds();
|
|
|
| - QuicTime::Delta srtt = rtt_stats->smoothed_rtt();
|
| - if (srtt.IsZero()) {
|
| - // If SRTT has not been set, use initial RTT instead.
|
| - srtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us());
|
| - }
|
| - stats_.srtt_us = srtt.ToMicroseconds();
|
| + QuicTime::Delta srtt = rtt_stats->smoothed_rtt();
|
| + if (srtt.IsZero()) {
|
| + // If SRTT has not been set, use initial RTT instead.
|
| + srtt = QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us());
|
| }
|
| + stats_.srtt_us = srtt.ToMicroseconds();
|
|
|
| stats_.estimated_bandwidth = sent_packet_manager_.BandwidthEstimate();
|
| stats_.max_packet_size = packet_generator_.max_packet_length();
|
| @@ -1403,7 +1396,8 @@ bool QuicConnection::WritePacketInner(QueuedPacket* packet) {
|
| return true;
|
| }
|
| // Connection close packets are encrypted and saved, so don't exit early.
|
| - if (writer_->IsWriteBlocked() && !IsConnectionClose(*packet)) {
|
| + const bool is_connection_close = IsConnectionClose(*packet);
|
| + if (writer_->IsWriteBlocked() && !is_connection_close) {
|
| return false;
|
| }
|
|
|
| @@ -1427,7 +1421,7 @@ bool QuicConnection::WritePacketInner(QueuedPacket* packet) {
|
| // Connection close packets are eventually owned by TimeWaitListManager.
|
| // Others are deleted at the end of this call.
|
| scoped_ptr<QuicEncryptedPacket> encrypted_deleter;
|
| - if (IsConnectionClose(*packet)) {
|
| + if (is_connection_close) {
|
| DCHECK(connection_close_packet_.get() == nullptr);
|
| connection_close_packet_.reset(encrypted);
|
| // This assures we won't try to write *forced* packets when blocked.
|
| @@ -1542,6 +1536,10 @@ bool QuicConnection::WritePacketInner(QueuedPacket* packet) {
|
|
|
| if (result.status == WRITE_STATUS_ERROR) {
|
| OnWriteError(result.error_code);
|
| + DLOG(ERROR) << ENDPOINT << "failed writing " << encrypted->length()
|
| + << "bytes "
|
| + << " from host " << self_address().ToStringWithoutPort()
|
| + << " to address " << peer_address().ToString();
|
| return false;
|
| }
|
|
|
| @@ -2104,15 +2102,14 @@ HasRetransmittableData QuicConnection::IsRetransmittable(
|
| }
|
| }
|
|
|
| -bool QuicConnection::IsConnectionClose(
|
| - QueuedPacket packet) {
|
| - RetransmittableFrames* retransmittable_frames =
|
| +bool QuicConnection::IsConnectionClose(const QueuedPacket& packet) {
|
| + const RetransmittableFrames* retransmittable_frames =
|
| packet.serialized_packet.retransmittable_frames;
|
| - if (!retransmittable_frames) {
|
| + if (retransmittable_frames == nullptr) {
|
| return false;
|
| }
|
| - for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) {
|
| - if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) {
|
| + for (const QuicFrame& frame : retransmittable_frames->frames()) {
|
| + if (frame.type == CONNECTION_CLOSE_FRAME) {
|
| return true;
|
| }
|
| }
|
|
|