Index: net/quic/quic_framer.cc |
diff --git a/net/quic/quic_framer.cc b/net/quic/quic_framer.cc |
index 9f94d5a2516bb02e694053b2b0d305603696d213..439fa643f17681d5f6a94879ba63dc6bbbfa626b 100644 |
--- a/net/quic/quic_framer.cc |
+++ b/net/quic/quic_framer.cc |
@@ -1359,6 +1359,7 @@ bool QuicFramer::ProcessAckFrame(QuicDataReader* reader, |
} |
// Parse the revived packets list. |
+ // TODO(ianswett): Change the ack frame so it only expresses one revived. |
uint8 num_revived_packets; |
if (!reader->ReadBytes(&num_revived_packets, 1)) { |
set_detailed_error("Unable to read num revived packets."); |
@@ -1372,8 +1373,7 @@ bool QuicFramer::ProcessAckFrame(QuicDataReader* reader, |
set_detailed_error("Unable to read revived packet."); |
return false; |
} |
- |
- ack_frame->revived_packets.insert(revived_packet); |
+ ack_frame->latest_revived_packet = revived_packet; |
} |
return true; |
@@ -1713,8 +1713,9 @@ size_t QuicFramer::GetAckFrameSize( |
ack_size += kNumberOfNackRangesSize + kNumberOfRevivedPacketsSize; |
ack_size += min(ack_info.nack_ranges.size(), kMaxNackRanges) * |
(missing_packet_number_length + PACKET_1BYTE_PACKET_NUMBER); |
- ack_size += min(ack.revived_packets.size(), |
- kMaxRevivedPackets) * largest_observed_length; |
+ if (ack.latest_revived_packet != 0) { |
+ ack_size += largest_observed_length; |
+ } |
} |
// In version 23, if the ack will be truncated due to too many nack ranges, |
@@ -2006,20 +2007,20 @@ bool QuicFramer::AppendAckFrameAndTypeByte( |
// Append revived packets. |
// If not all the revived packets fit, only mention the ones that do. |
- uint8 num_revived_packets = |
- static_cast<uint8>(min(frame.revived_packets.size(), kMaxRevivedPackets)); |
- num_revived_packets = static_cast<uint8>(min( |
- static_cast<size_t>(num_revived_packets), |
- (writer->capacity() - writer->length()) / largest_observed_length)); |
+ uint8 num_revived_packets = frame.latest_revived_packet == 0 ? 0 : 1; |
+ if (((writer->capacity() - writer->length()) / |
+ largest_observed_length) == 0) { |
+ num_revived_packets = 0; |
+ } |
if (!writer->WriteBytes(&num_revived_packets, 1)) { |
return false; |
} |
- PacketNumberSet::const_iterator iter = frame.revived_packets.begin(); |
- for (int i = 0; i < num_revived_packets; ++i, ++iter) { |
- LOG_IF(DFATAL, !frame.missing_packets.Contains(*iter)); |
+ if (num_revived_packets > 0) { |
+ LOG_IF(DFATAL, |
+ !frame.missing_packets.Contains(frame.latest_revived_packet)); |
if (!AppendPacketSequenceNumber(largest_observed_length, |
- *iter, writer)) { |
+ frame.latest_revived_packet, writer)) { |
return false; |
} |
} |