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

Unified Diff: net/quic/core/quic_connection.cc

Issue 2388153005: Record a QUIC packet as received once it's been decrypted, instead of waiting for it to be fully pr… (Closed)
Patch Set: Created 4 years, 2 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/core/quic_connection.cc
diff --git a/net/quic/core/quic_connection.cc b/net/quic/core/quic_connection.cc
index 822eeee8d030a1df9d0732af4a7b8a8320aea5ac..dadba8c67c7b3871d8b6459a9da4cd37c3b17408 100644
--- a/net/quic/core/quic_connection.cc
+++ b/net/quic/core/quic_connection.cc
@@ -210,6 +210,7 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
current_packet_data_(nullptr),
last_decrypted_packet_level_(ENCRYPTION_NONE),
should_last_packet_instigate_acks_(false),
+ was_last_packet_missing_(false),
largest_seen_packet_with_ack_(0),
largest_seen_packet_with_stop_waiting_(0),
max_undecryptable_packets_(0),
@@ -289,7 +290,9 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
<< "Created connection with connection_id: " << connection_id;
framer_.set_visitor(this);
framer_.set_received_entropy_calculator(&received_packet_manager_);
- last_stop_waiting_frame_.least_unacked = 0;
+ if (!FLAGS_quic_receive_packet_once_decrypted) {
+ last_stop_waiting_frame_.least_unacked = 0;
+ }
stats_.connection_creation_time = clock_->ApproximateNow();
if (FLAGS_quic_enable_multipath) {
sent_packet_manager_.reset(new QuicMultipathSentPacketManager(
@@ -661,6 +664,17 @@ bool QuicConnection::OnPacketHeader(const QuicPacketHeader& header) {
--stats_.packets_dropped;
DVLOG(1) << ENDPOINT << "Received packet header: " << header;
last_header_ = header;
+ if (FLAGS_quic_receive_packet_once_decrypted) {
+ // An ack will be sent if a missing retransmittable packet was received;
+ was_last_packet_missing_ =
+ received_packet_manager_.IsMissing(last_header_.packet_number);
+
+ // Record received to populate ack info correctly before processing stream
+ // frames, since the processing may result in a response packet with a
+ // bundled ack.
+ received_packet_manager_.RecordPacketReceived(
+ last_header_, time_of_last_received_packet_);
+ }
DCHECK(connected_);
return true;
}
@@ -778,7 +792,11 @@ bool QuicConnection::OnStopWaitingFrame(const QuicStopWaitingFrame& frame) {
debug_visitor_->OnStopWaitingFrame(frame);
}
- last_stop_waiting_frame_ = frame;
+ if (FLAGS_quic_receive_packet_once_decrypted) {
+ ProcessStopWaitingFrame(frame);
+ } else {
+ last_stop_waiting_frame_ = frame;
+ }
return connected_;
}
@@ -986,27 +1004,39 @@ void QuicConnection::OnPacketComplete() {
DVLOG(1) << ENDPOINT << "Got packet " << last_header_.packet_number << " for "
<< last_header_.public_header.connection_id;
- // An ack will be sent if a missing retransmittable packet was received;
- const bool was_missing =
- should_last_packet_instigate_acks_ &&
- received_packet_manager_.IsMissing(last_header_.packet_number);
-
- // Record received to populate ack info correctly before processing stream
- // frames, since the processing may result in a response packet with a bundled
- // ack.
- received_packet_manager_.RecordPacketReceived(last_header_,
- time_of_last_received_packet_);
-
- // Process stop waiting frames here, instead of inline, because the packet
- // needs to be considered 'received' before the entropy can be updated.
- if (last_stop_waiting_frame_.least_unacked > 0) {
- ProcessStopWaitingFrame(last_stop_waiting_frame_);
- if (!connected_) {
- return;
+ if (FLAGS_quic_receive_packet_once_decrypted) {
+ // An ack will be sent if a missing retransmittable packet was received;
+ const bool was_missing =
+ should_last_packet_instigate_acks_ && was_last_packet_missing_;
+
+ // It's possible the ack frame was sent along with response data, so it
+ // no longer needs to be sent.
+ if (ack_frame_updated()) {
+ MaybeQueueAck(was_missing);
+ }
+ } else {
+ // An ack will be sent if a missing retransmittable packet was received;
+ const bool was_missing =
+ should_last_packet_instigate_acks_ &&
+ received_packet_manager_.IsMissing(last_header_.packet_number);
+
+ // Record received to populate ack info correctly before processing stream
+ // frames, since the processing may result in a response packet with a
+ // bundled ack.
+ received_packet_manager_.RecordPacketReceived(
+ last_header_, time_of_last_received_packet_);
+
+ // Process stop waiting frames here, instead of inline, because the packet
+ // needs to be considered 'received' before the entropy can be updated.
+ if (last_stop_waiting_frame_.least_unacked > 0) {
+ ProcessStopWaitingFrame(last_stop_waiting_frame_);
+ if (!connected_) {
+ return;
+ }
}
- }
- MaybeQueueAck(was_missing);
+ MaybeQueueAck(was_missing);
+ }
ClearLastFrames();
MaybeCloseIfTooManyOutstandingPackets();
@@ -1078,7 +1108,9 @@ void QuicConnection::MaybeQueueAck(bool was_missing) {
void QuicConnection::ClearLastFrames() {
should_last_packet_instigate_acks_ = false;
- last_stop_waiting_frame_.least_unacked = 0;
+ if (!FLAGS_quic_receive_packet_once_decrypted) {
+ last_stop_waiting_frame_.least_unacked = 0;
+ }
}
void QuicConnection::MaybeCloseIfTooManyOutstandingPackets() {

Powered by Google App Engine
This is Rietveld 408576698