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

Unified Diff: net/quic/quic_connection.cc

Issue 903013002: Landing Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « net/quic/quic_connection.h ('k') | net/quic/quic_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698