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

Unified Diff: net/quic/quic_connection_logger.cc

Issue 549433006: Fix the logic for computing the number of truncated QUIC ACK frames sent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more comments Created 6 years, 3 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_logger.h ('k') | net/quic/quic_connection_logger_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection_logger.cc
diff --git a/net/quic/quic_connection_logger.cc b/net/quic/quic_connection_logger.cc
index ae67e08ae0778faba0f735311a6b6c669a07c938..acdb3f2976851497882098de195294478a065fc6 100644
--- a/net/quic/quic_connection_logger.cc
+++ b/net/quic/quic_connection_logger.cc
@@ -392,13 +392,32 @@ void QuicConnectionLogger::OnFrameAddedToPacket(const QuicFrame& frame) {
NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_SENT,
base::Bind(&NetLogQuicStreamFrameCallback, frame.stream_frame));
break;
- case ACK_FRAME:
+ case ACK_FRAME: {
net_log_.AddEvent(
NetLog::TYPE_QUIC_SESSION_ACK_FRAME_SENT,
base::Bind(&NetLogQuicAckFrameCallback, frame.ack_frame));
- if (frame.ack_frame->is_truncated)
- ++num_truncated_acks_sent_;
+ const SequenceNumberSet& missing_packets =
+ frame.ack_frame->missing_packets;
+ const uint8 max_ranges = std::numeric_limits<uint8>::max();
+ // Compute an upper bound on the number of NACK ranges. If the bound
+ // is below the max, then it clearly isn't truncated.
+ if (missing_packets.size() < max_ranges ||
+ (*missing_packets.rbegin() - *missing_packets.begin() -
+ missing_packets.size() + 1) < max_ranges) {
+ break;
+ }
+ size_t num_ranges = 0;
+ QuicPacketSequenceNumber last_missing = 0;
+ for (SequenceNumberSet::const_iterator it = missing_packets.begin();
+ it != missing_packets.end(); ++it) {
+ if (*it != last_missing + 1 && ++num_ranges >= max_ranges) {
+ ++num_truncated_acks_sent_;
+ break;
+ }
+ last_missing = *it;
+ }
break;
+ }
case CONGESTION_FEEDBACK_FRAME:
net_log_.AddEvent(
NetLog::TYPE_QUIC_SESSION_CONGESTION_FEEDBACK_FRAME_SENT,
« no previous file with comments | « net/quic/quic_connection_logger.h ('k') | net/quic/quic_connection_logger_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698