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

Unified Diff: net/quic/quic_received_packet_manager.cc

Issue 478153003: Change the wire format of the ack frame to include a compressed version (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
Index: net/quic/quic_received_packet_manager.cc
diff --git a/net/quic/quic_received_packet_manager.cc b/net/quic/quic_received_packet_manager.cc
index 15030a4e5d9ab79b544ffb3d1f8f69b69bdc82f0..98136f8564f35a70333dbbb705292df9ad667848 100644
--- a/net/quic/quic_received_packet_manager.cc
+++ b/net/quic/quic_received_packet_manager.cc
@@ -7,11 +7,13 @@
#include "base/logging.h"
#include "base/stl_util.h"
#include "net/base/linked_hash_map.h"
+#include "net/quic/crypto/crypto_protocol.h"
#include "net/quic/quic_connection_stats.h"
using std::make_pair;
using std::max;
using std::min;
+using std::numeric_limits;
namespace net {
@@ -128,11 +130,10 @@ AdvanceFirstGapAndGarbageCollectEntropyMap() {
}
QuicReceivedPacketManager::QuicReceivedPacketManager(
- CongestionFeedbackType congestion_type,
QuicConnectionStats* stats)
: peer_least_packet_awaiting_ack_(0),
time_largest_observed_(QuicTime::Zero()),
- receive_algorithm_(ReceiveAlgorithmInterface::Create(congestion_type)),
+ receive_algorithm_(ReceiveAlgorithmInterface::Create(kTCP)),
stats_(stats) {
ack_frame_.largest_observed = 0;
ack_frame_.entropy_hash = 0;
@@ -178,6 +179,9 @@ void QuicReceivedPacketManager::RecordPacketReceived(
receive_algorithm_->RecordIncomingPacket(
bytes, sequence_number, receipt_time);
+ received_packet_times_.push_back(
+ std::make_pair(sequence_number, receipt_time));
+
ack_frame_.revived_packets.erase(sequence_number);
}
@@ -216,6 +220,15 @@ void QuicReceivedPacketManager::UpdateReceivedPacketInfo(
ack_frame->delta_time_largest_observed =
approximate_now.Subtract(time_largest_observed_);
+
+ // Remove all packets that are too far from largest_observed to express.
+ received_packet_times_.remove_if(
+ [this] (std::pair<QuicPacketSequenceNumber, QuicTime> p)
+ { return ack_frame_.largest_observed - p.first >=
+ numeric_limits<uint8>::max();});
+
+ ack_frame->received_packet_times = received_packet_times_;
+ received_packet_times_.clear();
}
bool QuicReceivedPacketManager::GenerateCongestionFeedback(

Powered by Google App Engine
This is Rietveld 408576698