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

Unified Diff: net/quic/quic_packet_generator.cc

Issue 822713002: Update from https://crrev.com/309415 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years 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_packet_generator.cc
diff --git a/net/quic/quic_packet_generator.cc b/net/quic/quic_packet_generator.cc
index 21ab10c9e716bd2d12edff464bdb38a8c63320ff..2262883e1ce9c9dc359722d1ecdc6e45e2563822 100644
--- a/net/quic/quic_packet_generator.cc
+++ b/net/quic/quic_packet_generator.cc
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "net/quic/quic_fec_group.h"
+#include "net/quic/quic_flags.h"
#include "net/quic/quic_utils.h"
using base::StringPiece;
@@ -93,6 +94,23 @@ void QuicPacketGenerator::OnCongestionWindowChange(
void QuicPacketGenerator::SetShouldSendAck(bool also_send_feedback,
bool also_send_stop_waiting) {
+ if (FLAGS_quic_disallow_multiple_pending_ack_frames) {
+ if (pending_ack_frame_ != nullptr) {
+ // Ack already queued, nothing to do.
+ return;
+ }
+
+ if (also_send_feedback && pending_feedback_frame_ != nullptr) {
+ LOG(DFATAL) << "Should only ever be one pending feedback frame.";
+ return;
+ }
+
+ if (also_send_stop_waiting && pending_stop_waiting_frame_ != nullptr) {
+ LOG(DFATAL) << "Should only ever be one pending stop waiting frame.";
+ return;
+ }
+ }
+
should_send_ack_ = true;
should_send_feedback_ = also_send_feedback;
should_send_stop_waiting_ = also_send_stop_waiting;
@@ -347,6 +365,13 @@ void QuicPacketGenerator::SerializeAndSendPacket() {
DCHECK(serialized_packet.packet);
delegate_->OnSerializedPacket(serialized_packet);
MaybeSendFecPacketAndCloseGroup(false);
+
+ // The packet has now been serialized, safe to delete pending frames.
+ if (FLAGS_quic_disallow_multiple_pending_ack_frames) {
+ pending_ack_frame_.reset();
+ pending_feedback_frame_.reset();
+ pending_stop_waiting_frame_.reset();
+ }
}
void QuicPacketGenerator::StopSendingVersion() {

Powered by Google App Engine
This is Rietveld 408576698