summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorckrasic <ckrasic@chromium.org>2016-02-26 17:14:21 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-27 01:16:27 +0000
commit062b552bff78b7fc18ad694e28dc9a2173e60006 (patch)
tree6d1bda6c103965d09b1bf87fd008234a409fb633
parent7bc0980eafb9768f0ec99e278e01d19db52e26d9 (diff)
downloadchromium_src-062b552bff78b7fc18ad694e28dc9a2173e60006.zip
chromium_src-062b552bff78b7fc18ad694e28dc9a2173e60006.tar.gz
chromium_src-062b552bff78b7fc18ad694e28dc9a2173e60006.tar.bz2
Landing Recent QUIC changes until 2/19/2016 23:51:43 UTC
Add more logging when unencrypted stream frames are received. Merge internal change: 115108089 https://codereview.chromium.org/1738193003/ Fix QuicCryptoServerStreamTest.ConnectedAfterStatelessHandshake which was calling CryptoConnect twice on the same connection: once directly, and once via AdvanceHandshakeWithFakeClient. n/a - test only Merge internal change: 115098270 https://codereview.chromium.org/1738123003/ Add entropy to all QUIC client hellos. Merge internal change: 115084065 https://codereview.chromium.org/1735043006/ Make QuicPacketReader recvmmsg path more cache efficient. No functional change. Not flag protected. There were 2 unnecessary writes, and there was very little spacial locality before, which caused some cache inefficiency. Merge internal change: 115064166 https://codereview.chromium.org/1743673002/ Pull out QUIC client checks to see if an outgoing dynamic stream should be created into a method. No behavior change. Following structure of QuicServerSession: https://code.google.com/p/chromium/codesearch#chromium/src/net/tools/quic/quic_server_session_base.h&l=95 Merge internal change: 115003232 https://codereview.chromium.org/1740213002/ Deprecate --FLAGS_quic_crypto_proof_use_ref Merge internal change: 114992225 https://codereview.chromium.org/1736293003/ Remove unnecessary argument encrypted_length from QUIC's QuicSentPacketManager::OnPacketSent and QuicConnectionVisitor::OnPacketSent. No functional change. Merge internal change: 114990788 https://codereview.chromium.org/1728853002/ Deprecate --FLAGS_quic_set_client_hello_cb_nullptr. Merge internal change: 114959969 https://codereview.chromium.org/1728843002/ logging QUIC_INVALID_STREAM_FRAME in QuicStreamSequencer for debugging. No behavior change. QuicStreamSequencer::OnStreamData() is the only place closes connection because of QUIC_INVALID_STREAM_FRAME. Merge internal change: 114872901 https://codereview.chromium.org/1727883002/ Deprecate --gfe2_reloadable_flag_quic_utils_use_fast_incremental_hash. Merge internal change: 114857101 https://codereview.chromium.org/1726113002/ Deprecate FLAGS_quic_drop_non_awaited_packets. Merge internal change: 114856985 https://codereview.chromium.org/1729773002/ Deprecate FLAGS_use_stream_frame_freelist. Merge internal change: 114852282 https://codereview.chromium.org/1729583003/ R=rch@chromium.org BUG= Review URL: https://codereview.chromium.org/1738273002 Cr-Commit-Position: refs/heads/master@{#378048}
-rw-r--r--net/quic/congestion_control/general_loss_algorithm_test.cc2
-rw-r--r--net/quic/crypto/crypto_protocol.h1
-rw-r--r--net/quic/crypto/quic_crypto_client_config.cc10
-rw-r--r--net/quic/crypto/quic_crypto_client_config.h1
-rw-r--r--net/quic/crypto/quic_crypto_client_config_test.cc23
-rw-r--r--net/quic/crypto/quic_crypto_server_config.cc18
-rw-r--r--net/quic/quic_chromium_client_session.cc17
-rw-r--r--net/quic/quic_chromium_client_session.h1
-rw-r--r--net/quic/quic_connection.cc33
-rw-r--r--net/quic/quic_connection.h1
-rw-r--r--net/quic/quic_connection_logger.cc5
-rw-r--r--net/quic/quic_connection_logger.h1
-rw-r--r--net/quic/quic_connection_test.cc24
-rw-r--r--net/quic/quic_crypto_client_stream.cc3
-rw-r--r--net/quic/quic_crypto_server_stream.cc4
-rw-r--r--net/quic/quic_crypto_server_stream_test.cc5
-rw-r--r--net/quic/quic_flags.cc18
-rw-r--r--net/quic/quic_flags.h5
-rw-r--r--net/quic/quic_protocol.cc8
-rw-r--r--net/quic/quic_received_packet_manager.h3
-rw-r--r--net/quic/quic_sent_packet_manager.cc11
-rw-r--r--net/quic/quic_sent_packet_manager.h1
-rw-r--r--net/quic/quic_sent_packet_manager_test.cc36
-rw-r--r--net/quic/quic_stream_sequencer.cc4
-rw-r--r--net/quic/quic_unacked_packet_map.cc2
-rw-r--r--net/quic/quic_unacked_packet_map.h1
-rw-r--r--net/quic/quic_unacked_packet_map_test.cc73
-rw-r--r--net/quic/quic_utils.cc7
-rw-r--r--net/quic/quic_utils_test.cc14
-rw-r--r--net/quic/test_tools/quic_test_utils.cc2
-rw-r--r--net/quic/test_tools/quic_test_utils.h3
-rw-r--r--net/tools/quic/quic_client_session.cc15
-rw-r--r--net/tools/quic/quic_client_session.h5
-rw-r--r--net/tools/quic/quic_packet_reader.cc28
-rw-r--r--net/tools/quic/quic_packet_reader.h23
35 files changed, 166 insertions, 242 deletions
diff --git a/net/quic/congestion_control/general_loss_algorithm_test.cc b/net/quic/congestion_control/general_loss_algorithm_test.cc
index 797e465..580ce84 100644
--- a/net/quic/congestion_control/general_loss_algorithm_test.cc
+++ b/net/quic/congestion_control/general_loss_algorithm_test.cc
@@ -39,7 +39,7 @@ class GeneralLossAlgorithmTest : public ::testing::Test {
0, false, false);
packet.retransmittable_frames.push_back(QuicFrame(frame));
unacked_packets_.AddSentPacket(&packet, 0, NOT_RETRANSMISSION, clock_.Now(),
- 1000, true);
+ true);
}
void VerifyLosses(QuicPacketNumber largest_observed,
diff --git a/net/quic/crypto/crypto_protocol.h b/net/quic/crypto/crypto_protocol.h
index 1e0fcb9..5d2f71f 100644
--- a/net/quic/crypto/crypto_protocol.h
+++ b/net/quic/crypto/crypto_protocol.h
@@ -129,6 +129,7 @@ const QuicTag kCHID = TAG('C', 'H', 'I', 'D'); // Channel ID.
// Client hello tags
const QuicTag kVER = TAG('V', 'E', 'R', '\0'); // Version
const QuicTag kNONC = TAG('N', 'O', 'N', 'C'); // The client's nonce
+const QuicTag kNONP = TAG('N', 'O', 'N', 'P'); // The client's proof nonce
const QuicTag kKEXS = TAG('K', 'E', 'X', 'S'); // Key exchange methods
const QuicTag kAEAD = TAG('A', 'E', 'A', 'D'); // Authenticated
// encryption algorithms
diff --git a/net/quic/crypto/quic_crypto_client_config.cc b/net/quic/crypto/quic_crypto_client_config.cc
index bbd2d0d..bb71fcc 100644
--- a/net/quic/crypto/quic_crypto_client_config.cc
+++ b/net/quic/crypto/quic_crypto_client_config.cc
@@ -18,6 +18,7 @@
#include "net/quic/crypto/p256_key_exchange.h"
#include "net/quic/crypto/proof_verifier.h"
#include "net/quic/crypto/quic_encrypter.h"
+#include "net/quic/crypto/quic_random.h"
#include "net/quic/quic_bug_tracker.h"
#include "net/quic/quic_flags.h"
#include "net/quic/quic_utils.h"
@@ -405,6 +406,7 @@ void QuicCryptoClientConfig::FillInchoateClientHello(
const QuicServerId& server_id,
const QuicVersion preferred_version,
const CachedState* cached,
+ QuicRandom* rand,
QuicCryptoNegotiatedParameters* out_params,
CryptoHandshakeMessage* out) const {
out->set_tag(kCHLO);
@@ -421,6 +423,10 @@ void QuicCryptoClientConfig::FillInchoateClientHello(
out->SetStringPiece(kUAID, user_agent_id_);
}
+ char proof_nonce[32];
+ rand->RandBytes(proof_nonce, arraysize(proof_nonce));
+ out->SetStringPiece(kNONP, StringPiece(proof_nonce, arraysize(proof_nonce)));
+
// Even though this is an inchoate CHLO, send the SCID so that
// the STK can be validated by the server.
const CryptoHandshakeMessage* scfg = cached->GetServerConfig();
@@ -479,8 +485,8 @@ QuicErrorCode QuicCryptoClientConfig::FillClientHello(
string* error_details) const {
DCHECK(error_details != nullptr);
- FillInchoateClientHello(server_id, preferred_version, cached, out_params,
- out);
+ FillInchoateClientHello(server_id, preferred_version, cached, rand,
+ out_params, out);
const CryptoHandshakeMessage* scfg = cached->GetServerConfig();
if (!scfg) {
diff --git a/net/quic/crypto/quic_crypto_client_config.h b/net/quic/crypto/quic_crypto_client_config.h
index 34be548..9782f10 100644
--- a/net/quic/crypto/quic_crypto_client_config.h
+++ b/net/quic/crypto/quic_crypto_client_config.h
@@ -210,6 +210,7 @@ class NET_EXPORT_PRIVATE QuicCryptoClientConfig : public QuicCryptoConfig {
void FillInchoateClientHello(const QuicServerId& server_id,
const QuicVersion preferred_version,
const CachedState* cached,
+ QuicRandom* rand,
QuicCryptoNegotiatedParameters* out_params,
CryptoHandshakeMessage* out) const;
diff --git a/net/quic/crypto/quic_crypto_client_config_test.cc b/net/quic/crypto/quic_crypto_client_config_test.cc
index 2e6866c..0aff310 100644
--- a/net/quic/crypto/quic_crypto_client_config_test.cc
+++ b/net/quic/crypto/quic_crypto_client_config_test.cc
@@ -156,12 +156,16 @@ TEST(QuicCryptoClientConfigTest, InchoateChlo) {
QuicCryptoNegotiatedParameters params;
CryptoHandshakeMessage msg;
QuicServerId server_id("www.google.com", 80, PRIVACY_MODE_DISABLED);
- config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &params,
- &msg);
+ MockRandom rand;
+ config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &rand,
+ &params, &msg);
QuicTag cver;
EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kVER, &cver));
EXPECT_EQ(QuicVersionToQuicTag(QuicVersionMax()), cver);
+ StringPiece proof_nonce;
+ EXPECT_TRUE(msg.GetStringPiece(kNONP, &proof_nonce));
+ EXPECT_EQ(string(32, 'r'), proof_nonce);
}
TEST(QuicCryptoClientConfigTest, PreferAesGcm) {
@@ -178,8 +182,9 @@ TEST(QuicCryptoClientConfigTest, InchoateChloSecure) {
QuicCryptoNegotiatedParameters params;
CryptoHandshakeMessage msg;
QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
- config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &params,
- &msg);
+ MockRandom rand;
+ config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &rand,
+ &params, &msg);
QuicTag pdmd;
EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kPDMD, &pdmd));
@@ -203,8 +208,9 @@ TEST(QuicCryptoClientConfigTest, InchoateChloSecureWithSCID) {
QuicCryptoNegotiatedParameters params;
CryptoHandshakeMessage msg;
QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
- config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &params,
- &msg);
+ MockRandom rand;
+ config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &rand,
+ &params, &msg);
StringPiece scid;
EXPECT_TRUE(msg.GetStringPiece(kSCID, &scid));
@@ -218,8 +224,9 @@ TEST(QuicCryptoClientConfigTest, InchoateChloSecureNoEcdsa) {
QuicCryptoNegotiatedParameters params;
CryptoHandshakeMessage msg;
QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
- config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &params,
- &msg);
+ MockRandom rand;
+ config.FillInchoateClientHello(server_id, QuicVersionMax(), &state, &rand,
+ &params, &msg);
QuicTag pdmd;
EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kPDMD, &pdmd));
diff --git a/net/quic/crypto/quic_crypto_server_config.cc b/net/quic/crypto/quic_crypto_server_config.cc
index a96943f..cd14bc1 100644
--- a/net/quic/crypto/quic_crypto_server_config.cc
+++ b/net/quic/crypto/quic_crypto_server_config.cc
@@ -532,11 +532,7 @@ void QuicCryptoServerConfig::ValidateClientHello(
requested_config = GetConfigWithScid(requested_scid);
primary_config = primary_config_;
- if (FLAGS_quic_crypto_proof_use_ref) {
- crypto_proof->config = primary_config_;
- } else {
- crypto_proof->primary_scid = primary_config->id;
- }
+ crypto_proof->config = primary_config_;
}
if (result->error_code == QUIC_NO_ERROR) {
@@ -596,17 +592,7 @@ QuicErrorCode QuicCryptoServerConfig::ProcessClientHello(
// Use the config that the client requested in order to do key-agreement.
// Otherwise give it a copy of |primary_config_| to use.
- if (FLAGS_quic_crypto_proof_use_ref) {
- primary_config = crypto_proof->config;
- } else {
- primary_config = GetConfigWithScid(crypto_proof->primary_scid);
- }
- if (!primary_config) {
- *error_details = "Configuration not found";
- QUIC_BUG << "Primary config not found";
- return QUIC_CRYPTO_INTERNAL_ERROR;
- }
-
+ primary_config = crypto_proof->config;
requested_config = GetConfigWithScid(requested_scid);
}
diff --git a/net/quic/quic_chromium_client_session.cc b/net/quic/quic_chromium_client_session.cc
index 78044e8..328a133 100644
--- a/net/quic/quic_chromium_client_session.cc
+++ b/net/quic/quic_chromium_client_session.cc
@@ -417,24 +417,31 @@ void QuicChromiumClientSession::CancelRequest(StreamRequest* request) {
}
}
-QuicChromiumClientStream*
-QuicChromiumClientSession::CreateOutgoingDynamicStream(SpdyPriority priority) {
+bool QuicChromiumClientSession::ShouldCreateOutgoingDynamicStream() {
if (!crypto_stream_->encryption_established()) {
DVLOG(1) << "Encryption not active so no outgoing stream created.";
- return nullptr;
+ return false;
}
if (GetNumOpenOutgoingStreams() >= max_open_outgoing_streams()) {
DVLOG(1) << "Failed to create a new outgoing stream. "
<< "Already " << GetNumOpenOutgoingStreams() << " open.";
- return nullptr;
+ return false;
}
if (goaway_received()) {
DVLOG(1) << "Failed to create a new outgoing stream. "
<< "Already received goaway.";
- return nullptr;
+ return false;
}
if (going_away_) {
RecordUnexpectedOpenStreams(CREATE_OUTGOING_RELIABLE_STREAM);
+ return false;
+ }
+ return true;
+}
+
+QuicChromiumClientStream*
+QuicChromiumClientSession::CreateOutgoingDynamicStream(SpdyPriority priority) {
+ if (!ShouldCreateOutgoingDynamicStream()) {
return nullptr;
}
return CreateOutgoingReliableStreamImpl();
diff --git a/net/quic/quic_chromium_client_session.h b/net/quic/quic_chromium_client_session.h
index 4498aa0..d33beb4 100644
--- a/net/quic/quic_chromium_client_session.h
+++ b/net/quic/quic_chromium_client_session.h
@@ -153,6 +153,7 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession
// QuicSession methods:
void OnStreamFrame(const QuicStreamFrame& frame) override;
+ bool ShouldCreateOutgoingDynamicStream();
QuicChromiumClientStream* CreateOutgoingDynamicStream(
SpdyPriority priority) override;
QuicCryptoClientStream* GetCryptoStream() override;
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
index fadf5f451..1dd656e 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -644,8 +644,7 @@ bool QuicConnection::OnUnauthenticatedHeader(const QuicPacketHeader& header) {
// If this packet has already been seen, or the sender has told us that it
// will not be retransmitted, then stop processing the packet.
- if (FLAGS_quic_drop_non_awaited_packets &&
- !received_packet_manager_.IsAwaitingPacket(header.packet_number)) {
+ if (!received_packet_manager_.IsAwaitingPacket(header.packet_number)) {
DVLOG(1) << ENDPOINT << "Packet " << header.packet_number
<< " no longer being waited for. Discarding.";
if (debug_visitor_ != nullptr) {
@@ -706,8 +705,10 @@ bool QuicConnection::OnStreamFrame(const QuicStreamFrame& frame) {
}
if (frame.stream_id != kCryptoStreamId &&
last_decrypted_packet_level_ == ENCRYPTION_NONE) {
- DLOG(WARNING) << ENDPOINT
- << "Received an unencrypted data frame: closing connection";
+ QUIC_BUG << ENDPOINT
+ << "Received an unencrypted data frame: closing connection"
+ << " packet_number:" << last_header_.packet_number
+ << " received_packets:" << received_packet_manager_.ack_frame();
SendConnectionCloseWithDetails(QUIC_UNENCRYPTED_STREAM_DATA,
"Unencrypted stream data seen");
return false;
@@ -1412,18 +1413,6 @@ bool QuicConnection::ProcessValidatedPacket(const QuicPacketHeader& header) {
return false;
}
- // If this packet has already been seen, or the sender has told us that it
- // will not be retransmitted, then stop processing the packet.
- if (!FLAGS_quic_drop_non_awaited_packets &&
- !received_packet_manager_.IsAwaitingPacket(header.packet_number)) {
- DVLOG(1) << ENDPOINT << "Packet " << header.packet_number
- << " no longer being waited for. Discarding.";
- if (debug_visitor_ != nullptr) {
- debug_visitor_->OnDuplicatePacket(header.packet_number);
- }
- return false;
- }
-
if (version_negotiation_state_ != NEGOTIATED_VERSION) {
if (perspective_ == Perspective::IS_SERVER) {
if (!header.public_header.version_flag) {
@@ -1664,8 +1653,7 @@ bool QuicConnection::WritePacket(SerializedPacket* packet) {
if (result.status != WRITE_STATUS_ERROR && debug_visitor_ != nullptr) {
// Pass the write result to the visitor.
debug_visitor_->OnPacketSent(*packet, packet->original_packet_number,
- packet->transmission_type, encrypted_length,
- packet_send_time);
+ packet->transmission_type, packet_send_time);
}
if (packet->transmission_type == NOT_RETRANSMISSION) {
time_of_last_sent_new_packet_ = packet_send_time;
@@ -1689,7 +1677,7 @@ bool QuicConnection::WritePacket(SerializedPacket* packet) {
bool reset_retransmission_alarm = sent_packet_manager_.OnPacketSent(
packet, packet->original_packet_number, packet_send_time,
- encrypted_length, packet->transmission_type, IsRetransmittable(*packet));
+ packet->transmission_type, IsRetransmittable(*packet));
if (reset_retransmission_alarm || !retransmission_alarm_->IsSet()) {
SetRetransmissionAlarm();
@@ -2025,8 +2013,7 @@ void QuicConnection::MaybeProcessRevivedPacket() {
QuicFecGroup* QuicConnection::GetFecGroup() {
QuicFecGroupNumber fec_group_num = last_header_.fec_group;
if (fec_group_num == 0 ||
- (FLAGS_quic_drop_non_awaited_packets &&
- fec_group_num <
+ (fec_group_num <
received_packet_manager_.peer_least_packet_awaiting_ack() &&
!ContainsKey(group_map_, fec_group_num))) {
// If the group number is below peer_least_packet_awaiting_ack and this
@@ -2129,9 +2116,7 @@ void QuicConnection::CloseFecGroupsBefore(QuicPacketNumber packet_number) {
FecGroupMap::iterator it = group_map_.begin();
while (it != group_map_.end()) {
// If the group doesn't protect this packet we can ignore it.
- if ((!FLAGS_quic_drop_non_awaited_packets &&
- last_header_.fec_group == it->first) ||
- !it->second->IsWaitingForPacketBefore(packet_number)) {
+ if (!it->second->IsWaitingForPacketBefore(packet_number)) {
++it;
continue;
}
diff --git a/net/quic/quic_connection.h b/net/quic/quic_connection.h
index 875f7df..df649b5 100644
--- a/net/quic/quic_connection.h
+++ b/net/quic/quic_connection.h
@@ -169,7 +169,6 @@ class NET_EXPORT_PRIVATE QuicConnectionDebugVisitor
virtual void OnPacketSent(const SerializedPacket& serialized_packet,
QuicPacketNumber original_packet_number,
TransmissionType transmission_type,
- size_t encrypted_length,
QuicTime sent_time) {}
// Called when a packet has been received, but before it is
diff --git a/net/quic/quic_connection_logger.cc b/net/quic/quic_connection_logger.cc
index 96c6425..fe529d8 100644
--- a/net/quic/quic_connection_logger.cc
+++ b/net/quic/quic_connection_logger.cc
@@ -52,14 +52,12 @@ scoped_ptr<base::Value> NetLogQuicPacketCallback(
scoped_ptr<base::Value> NetLogQuicPacketSentCallback(
const SerializedPacket& serialized_packet,
TransmissionType transmission_type,
- size_t packet_size,
QuicTime sent_time,
NetLogCaptureMode /* capture_mode */) {
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetInteger("transmission_type", transmission_type);
dict->SetString("packet_number",
base::Uint64ToString(serialized_packet.packet_number));
- dict->SetInteger("size", packet_size);
dict->SetString("sent_time_us",
base::Int64ToString(sent_time.ToDebuggingValue()));
return std::move(dict);
@@ -430,13 +428,12 @@ void QuicConnectionLogger::OnPacketSent(
const SerializedPacket& serialized_packet,
QuicPacketNumber original_packet_number,
TransmissionType transmission_type,
- size_t encrypted_length,
QuicTime sent_time) {
if (original_packet_number == 0) {
net_log_.AddEvent(
NetLog::TYPE_QUIC_SESSION_PACKET_SENT,
base::Bind(&NetLogQuicPacketSentCallback, serialized_packet,
- transmission_type, encrypted_length, sent_time));
+ transmission_type, sent_time));
} else {
net_log_.AddEvent(
NetLog::TYPE_QUIC_SESSION_PACKET_RETRANSMITTED,
diff --git a/net/quic/quic_connection_logger.h b/net/quic/quic_connection_logger.h
index bdc5e6a..f059ef9 100644
--- a/net/quic/quic_connection_logger.h
+++ b/net/quic/quic_connection_logger.h
@@ -47,7 +47,6 @@ class NET_EXPORT_PRIVATE QuicConnectionLogger
void OnPacketSent(const SerializedPacket& serialized_packet,
QuicPacketNumber original_packet_number,
TransmissionType transmission_type,
- size_t encrypted_length,
QuicTime sent_time) override;
void OnPacketReceived(const IPEndPoint& self_address,
const IPEndPoint& peer_address,
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index 55475c4..c30ac0a 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -1398,7 +1398,7 @@ TEST_P(QuicConnectionTest, RejectUnencryptedStreamData) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_UNENCRYPTED_STREAM_DATA,
ConnectionCloseSource::FROM_SELF));
- ProcessDataPacket(kDefaultPathId, 1, 0, !kEntropyFlag);
+ EXPECT_DFATAL(ProcessDataPacket(kDefaultPathId, 1, 0, !kEntropyFlag), "");
EXPECT_FALSE(QuicConnectionPeer::GetConnectionClosePacket(&connection_) ==
nullptr);
const vector<QuicConnectionCloseFrame>& connection_close_frames =
@@ -3517,24 +3517,9 @@ TEST_P(QuicConnectionTest, CloseFecGroup) {
ASSERT_EQ(0u, connection_.NumFecGroups());
}
-TEST_P(QuicConnectionTest, FailedToCloseFecGroupWithFecProtectedStopWaiting) {
- EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- ValueRestore<bool> old_flag(&FLAGS_quic_drop_non_awaited_packets, false);
- // Don't send missing packet 1.
- ProcessFecProtectedPacket(kDefaultPathId, 2, false, !kEntropyFlag,
- !kHasStopWaiting);
- EXPECT_EQ(1u, connection_.NumFecGroups());
- stop_waiting_ = InitStopWaitingFrame(3);
- ProcessFecProtectedPacket(kDefaultPathId, 3, false, !kEntropyFlag,
- kHasStopWaiting);
- // This Fec group would be closed but created again.
- EXPECT_EQ(1u, connection_.NumFecGroups());
-}
-
TEST_P(QuicConnectionTest,
CloseFecGroupUnderStopWaitingAndWaitingForPacketsBelowStopWaiting) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- ValueRestore<bool> old_flag(&FLAGS_quic_drop_non_awaited_packets, true);
// Don't send missing packet 1.
ProcessFecProtectedPacket(kDefaultPathId, 2, false, !kEntropyFlag,
!kHasStopWaiting);
@@ -3549,7 +3534,6 @@ TEST_P(QuicConnectionTest,
TEST_P(QuicConnectionTest,
DoNotCloseFecGroupUnderStopWaitingButNotWaitingForPacketsBelow) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- ValueRestore<bool> old_flag(&FLAGS_quic_drop_non_awaited_packets, true);
ProcessFecProtectedPacket(kDefaultPathId, 1, false, !kEntropyFlag,
!kHasStopWaiting);
ProcessFecProtectedPacket(kDefaultPathId, 2, false, !kEntropyFlag,
@@ -5385,10 +5369,8 @@ TEST_P(QuicConnectionTest, OnPacketHeaderDebugVisitor) {
new MockQuicConnectionDebugVisitor());
connection_.set_debug_visitor(debug_visitor.get());
EXPECT_CALL(*debug_visitor, OnPacketHeader(Ref(header))).Times(1);
- if (FLAGS_quic_drop_non_awaited_packets) {
- EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)).Times(1);
- EXPECT_CALL(*debug_visitor, OnSuccessfulVersionNegotiation(_)).Times(1);
- }
+ EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)).Times(1);
+ EXPECT_CALL(*debug_visitor, OnSuccessfulVersionNegotiation(_)).Times(1);
connection_.OnPacketHeader(header);
}
diff --git a/net/quic/quic_crypto_client_stream.cc b/net/quic/quic_crypto_client_stream.cc
index 54c0de8..3e52079 100644
--- a/net/quic/quic_crypto_client_stream.cc
+++ b/net/quic/quic_crypto_client_stream.cc
@@ -307,7 +307,8 @@ void QuicCryptoClientStream::DoSendCHLO(
if (!cached->IsComplete(session()->connection()->clock()->WallNow())) {
crypto_config_->FillInchoateClientHello(
server_id_, session()->connection()->supported_versions().front(),
- cached, &crypto_negotiated_params_, &out);
+ cached, session()->connection()->random_generator(),
+ &crypto_negotiated_params_, &out);
// Pad the inchoate client hello to fill up a packet.
const QuicByteCount kFramingOverhead = 50; // A rough estimate.
const QuicByteCount max_packet_size =
diff --git a/net/quic/quic_crypto_server_stream.cc b/net/quic/quic_crypto_server_stream.cc
index 62c4d58..f53602e 100644
--- a/net/quic/quic_crypto_server_stream.cc
+++ b/net/quic/quic_crypto_server_stream.cc
@@ -69,9 +69,7 @@ void QuicCryptoServerStream::CancelOutstandingCallbacks() {
// Detach from the validation callback. Calling this multiple times is safe.
if (validate_client_hello_cb_ != nullptr) {
validate_client_hello_cb_->Cancel();
- if (FLAGS_quic_set_client_hello_cb_nullptr) {
- validate_client_hello_cb_ = nullptr;
- }
+ validate_client_hello_cb_ = nullptr;
}
}
diff --git a/net/quic/quic_crypto_server_stream_test.cc b/net/quic/quic_crypto_server_stream_test.cc
index a815f99..4b32c18 100644
--- a/net/quic/quic_crypto_server_stream_test.cc
+++ b/net/quic/quic_crypto_server_stream_test.cc
@@ -292,8 +292,6 @@ TEST_P(QuicCryptoServerStreamTest, ConnectedAfterStatelessHandshake) {
InitializeFakeClient(/* supports_stateless_rejects= */ true);
- client_stream()->CryptoConnect();
-
// In the stateless case, the second handshake contains a server-nonce, so the
// AsyncStrikeRegisterVerification() case will still succeed (unlike a 0-RTT
// handshake).
@@ -302,7 +300,7 @@ TEST_P(QuicCryptoServerStreamTest, ConnectedAfterStatelessHandshake) {
// On the second round, encryption will be established.
EXPECT_TRUE(server_stream()->encryption_established());
EXPECT_TRUE(server_stream()->handshake_confirmed());
- EXPECT_EQ(2, server_stream()->NumHandshakeMessages());
+ EXPECT_EQ(1, server_stream()->NumHandshakeMessages());
EXPECT_EQ(1, server_stream()->NumHandshakeMessagesWithServerNonces());
}
@@ -485,7 +483,6 @@ TEST_P(QuicCryptoServerStreamTest, NoTokenBindingWithoutClientSupport) {
TEST_P(QuicCryptoServerStreamTest, CancelRPCBeforeVerificationCompletes) {
// Tests that the client can close the connection while the remote strike
// register verification RPC is still pending.
- ValueRestore<bool> old_flag(&FLAGS_quic_set_client_hello_cb_nullptr, true);
// Set version to QUIC_VERSION_25 as QUIC_VERSION_26 and later don't support
// asynchronous strike register RPCs.
diff --git a/net/quic/quic_flags.cc b/net/quic/quic_flags.cc
index 5818a62..66868e7 100644
--- a/net/quic/quic_flags.cc
+++ b/net/quic/quic_flags.cc
@@ -78,10 +78,6 @@ bool FLAGS_quic_use_stream_sequencer_buffer = true;
// If true, don't send QUIC packets if the send alarm is set.
bool FLAGS_quic_respect_send_alarm2 = true;
-// If ture, sets callback pointer to nullptr after calling Cancel() in
-// QuicCryptoServerStream::CancelOutstandingCallbacks.
-bool FLAGS_quic_set_client_hello_cb_nullptr = true;
-
// If true, allow each quic stream to write 16k blocks rather than doing a round
// robin of one packet per session when ack clocked or paced.
bool FLAGS_quic_batch_writes = true;
@@ -118,12 +114,6 @@ bool FLAGS_quic_validate_stk_without_scid = true;
// If true, QUIC will support RFC 7539 variants of ChaCha20 Poly1305.
bool FLAGS_quic_use_rfc7539 = true;
-// If true, drop not awaited QUIC packets before decrypting them.
-bool FLAGS_quic_drop_non_awaited_packets = false;
-
-// If true, use the fast implementation of IncrementalHash/FNV1a_128_Hash.
-bool FLAGS_quic_utils_use_fast_incremental_hash = true;
-
// If true, require QUIC connections to use a valid server nonce or a non-local
// strike register.
bool FLAGS_require_strike_register_or_server_nonce = true;
@@ -131,10 +121,6 @@ bool FLAGS_require_strike_register_or_server_nonce = true;
// When turn on, log packet loss into transport connection stats LossEvent.
bool FLAGS_quic_log_loss_event = true;
-// If true, use a free list for the stream frame buffer allocations in
-// QuicPacketCreator.
-bool FLAGS_use_stream_frame_freelist = true;
-
// If true, for QUIC authenticated encryption algorithms, last 8 bytes
// of IV comprise packet path id and lower 7 bytes of packet number.
bool FLAGS_quic_include_path_id_in_iv = true;
@@ -143,10 +129,6 @@ bool FLAGS_quic_include_path_id_in_iv = true;
// priority (or batch) streams when doing QUIC writes.
bool FLAGS_quic_cede_correctly = true;
-// Has QuicCryptoProof hold a ref to the primary_config instead of storing its
-// SCID.
-bool FLAGS_quic_crypto_proof_use_ref = true;
-
// If on, max number of incoming and outgoing streams will be different.
// Incoming will be a little higher than outgoing to tolerate race condition.
bool FLAGS_quic_different_max_num_open_streams = true;
diff --git a/net/quic/quic_flags.h b/net/quic/quic_flags.h
index 71983cb..a991a59 100644
--- a/net/quic/quic_flags.h
+++ b/net/quic/quic_flags.h
@@ -27,7 +27,6 @@ NET_EXPORT_PRIVATE extern bool FLAGS_quic_disable_pacing;
NET_EXPORT_PRIVATE extern bool FLAGS_quic_use_new_idle_timeout;
NET_EXPORT_PRIVATE extern bool FLAGS_quic_use_stream_sequencer_buffer;
NET_EXPORT_PRIVATE extern bool FLAGS_quic_respect_send_alarm2;
-NET_EXPORT_PRIVATE extern bool FLAGS_quic_set_client_hello_cb_nullptr;
NET_EXPORT_PRIVATE extern bool FLAGS_quic_batch_writes;
NET_EXPORT_PRIVATE extern bool FLAGS_quic_block_unencrypted_writes;
NET_EXPORT_PRIVATE extern bool FLAGS_quic_never_write_unencrypted_data;
@@ -38,14 +37,10 @@ NET_EXPORT_PRIVATE extern bool FLAGS_quic_supports_push_promise;
NET_EXPORT_PRIVATE extern bool FLAGS_quic_distinguish_incoming_outgoing_streams;
NET_EXPORT_PRIVATE extern bool FLAGS_quic_validate_stk_without_scid;
NET_EXPORT_PRIVATE extern bool FLAGS_quic_use_rfc7539;
-NET_EXPORT_PRIVATE extern bool FLAGS_quic_drop_non_awaited_packets;
-NET_EXPORT_PRIVATE extern bool FLAGS_quic_utils_use_fast_incremental_hash;
NET_EXPORT_PRIVATE extern bool FLAGS_require_strike_register_or_server_nonce;
NET_EXPORT_PRIVATE extern bool FLAGS_quic_log_loss_event;
-NET_EXPORT_PRIVATE extern bool FLAGS_use_stream_frame_freelist;
NET_EXPORT_PRIVATE extern bool FLAGS_quic_include_path_id_in_iv;
NET_EXPORT_PRIVATE extern bool FLAGS_quic_cede_correctly;
-NET_EXPORT_PRIVATE extern bool FLAGS_quic_crypto_proof_use_ref;
NET_EXPORT_PRIVATE extern bool FLAGS_quic_different_max_num_open_streams;
NET_EXPORT_PRIVATE extern bool
FLAGS_quic_crypto_server_config_default_has_chacha20;
diff --git a/net/quic/quic_protocol.cc b/net/quic/quic_protocol.cc
index cb43400..7de88d7 100644
--- a/net/quic/quic_protocol.cc
+++ b/net/quic/quic_protocol.cc
@@ -110,17 +110,13 @@ QuicBufferAllocator::~QuicBufferAllocator() = default;
void StreamBufferDeleter::operator()(char* buffer) const {
if (allocator_ != nullptr && buffer != nullptr) {
allocator_->Delete(buffer);
- if (!FLAGS_use_stream_frame_freelist) {
- allocator_->MarkAllocatorIdle();
- }
}
}
UniqueStreamBuffer NewStreamBuffer(QuicBufferAllocator* allocator,
size_t size) {
- return UniqueStreamBuffer(
- allocator->New(size, FLAGS_use_stream_frame_freelist),
- StreamBufferDeleter(allocator));
+ return UniqueStreamBuffer(allocator->New(size),
+ StreamBufferDeleter(allocator));
}
QuicStreamFrame::QuicStreamFrame()
diff --git a/net/quic/quic_received_packet_manager.h b/net/quic/quic_received_packet_manager.h
index 5adafa6..404f24f 100644
--- a/net/quic/quic_received_packet_manager.h
+++ b/net/quic/quic_received_packet_manager.h
@@ -144,6 +144,9 @@ class NET_EXPORT_PRIVATE QuicReceivedPacketManager
virtual bool ack_frame_updated() const;
+ // For logging purposes.
+ const QuicAckFrame& ack_frame() const { return ack_frame_; }
+
private:
friend class test::QuicConnectionPeer;
friend class test::QuicReceivedPacketManagerPeer;
diff --git a/net/quic/quic_sent_packet_manager.cc b/net/quic/quic_sent_packet_manager.cc
index 78536f0..fbe446b 100644
--- a/net/quic/quic_sent_packet_manager.cc
+++ b/net/quic/quic_sent_packet_manager.cc
@@ -548,13 +548,13 @@ bool QuicSentPacketManager::OnPacketSent(
SerializedPacket* serialized_packet,
QuicPacketNumber original_packet_number,
QuicTime sent_time,
- QuicByteCount bytes,
TransmissionType transmission_type,
HasRetransmittableData has_retransmittable_data) {
QuicPacketNumber packet_number = serialized_packet->packet_number;
DCHECK_LT(0u, packet_number);
DCHECK(!unacked_packets_.IsUnacked(packet_number));
- QUIC_BUG_IF(bytes == 0) << "Cannot send empty packets.";
+ QUIC_BUG_IF(serialized_packet->encrypted_length == 0)
+ << "Cannot send empty packets.";
if (delegate_ == nullptr && original_packet_number != 0) {
if (!pending_retransmissions_.erase(original_packet_number)) {
@@ -576,12 +576,11 @@ bool QuicSentPacketManager::OnPacketSent(
: has_retransmittable_data;
// TODO(ianswett): Remove sent_time, because it's unused.
const bool in_flight = send_algorithm_->OnPacketSent(
- sent_time, unacked_packets_.bytes_in_flight(), packet_number, bytes,
- has_congestion_controlled_data);
+ sent_time, unacked_packets_.bytes_in_flight(), packet_number,
+ serialized_packet->encrypted_length, has_congestion_controlled_data);
unacked_packets_.AddSentPacket(serialized_packet, original_packet_number,
- transmission_type, sent_time, bytes,
- in_flight);
+ transmission_type, sent_time, in_flight);
// Reset the retransmission timer anytime a pending packet is sent.
return in_flight;
}
diff --git a/net/quic/quic_sent_packet_manager.h b/net/quic/quic_sent_packet_manager.h
index 61695d4..15b12d6 100644
--- a/net/quic/quic_sent_packet_manager.h
+++ b/net/quic/quic_sent_packet_manager.h
@@ -179,7 +179,6 @@ class NET_EXPORT_PRIVATE QuicSentPacketManager {
virtual bool OnPacketSent(SerializedPacket* serialized_packet,
QuicPacketNumber original_packet_number,
QuicTime sent_time,
- QuicByteCount bytes,
TransmissionType transmission_type,
HasRetransmittableData has_retransmittable_data);
diff --git a/net/quic/quic_sent_packet_manager_test.cc b/net/quic/quic_sent_packet_manager_test.cc
index d641472..f8cfce7 100644
--- a/net/quic/quic_sent_packet_manager_test.cc
+++ b/net/quic/quic_sent_packet_manager_test.cc
@@ -185,8 +185,7 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
.WillOnce(Return(true));
SerializedPacket packet(CreatePacket(new_packet_number, false));
manager_.OnPacketSent(&packet, old_packet_number, clock_.Now(),
- kDefaultLength, TLP_RETRANSMISSION,
- HAS_RETRANSMITTABLE_DATA);
+ TLP_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA);
EXPECT_TRUE(QuicSentPacketManagerPeer::IsRetransmission(&manager_,
new_packet_number));
}
@@ -221,8 +220,8 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
.Times(1)
.WillOnce(Return(true));
SerializedPacket packet(CreateDataPacket(packet_number));
- manager_.OnPacketSent(&packet, 0, clock_.Now(), packet.encrypted_length,
- NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA);
+ manager_.OnPacketSent(&packet, 0, clock_.Now(), NOT_RETRANSMISSION,
+ HAS_RETRANSMITTABLE_DATA);
}
void SendCryptoPacket(QuicPacketNumber packet_number) {
@@ -235,8 +234,8 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
packet.retransmittable_frames.push_back(
QuicFrame(new QuicStreamFrame(1, false, 0, StringPiece())));
packet.has_crypto_handshake = IS_HANDSHAKE;
- manager_.OnPacketSent(&packet, 0, clock_.Now(), packet.encrypted_length,
- NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA);
+ manager_.OnPacketSent(&packet, 0, clock_.Now(), NOT_RETRANSMISSION,
+ HAS_RETRANSMITTABLE_DATA);
}
void SendFecPacket(QuicPacketNumber packet_number) {
@@ -246,8 +245,8 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
.Times(1)
.WillOnce(Return(true));
SerializedPacket packet(CreateFecPacket(packet_number));
- manager_.OnPacketSent(&packet, 0, clock_.Now(), packet.encrypted_length,
- NOT_RETRANSMISSION, NO_RETRANSMITTABLE_DATA);
+ manager_.OnPacketSent(&packet, 0, clock_.Now(), NOT_RETRANSMISSION,
+ NO_RETRANSMITTABLE_DATA);
}
void SendAckPacket(QuicPacketNumber packet_number) {
@@ -257,8 +256,8 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
.Times(1)
.WillOnce(Return(false));
SerializedPacket packet(CreatePacket(packet_number, false));
- manager_.OnPacketSent(&packet, 0, clock_.Now(), packet.encrypted_length,
- NOT_RETRANSMISSION, NO_RETRANSMITTABLE_DATA);
+ manager_.OnPacketSent(&packet, 0, clock_.Now(), NOT_RETRANSMISSION,
+ NO_RETRANSMITTABLE_DATA);
}
// Based on QuicConnection's WritePendingRetransmissions.
@@ -272,8 +271,7 @@ class QuicSentPacketManagerTest : public ::testing::TestWithParam<bool> {
const PendingRetransmission pending = manager_.NextPendingRetransmission();
SerializedPacket packet(CreatePacket(retransmission_packet_number, false));
manager_.OnPacketSent(&packet, pending.packet_number, clock_.Now(),
- kDefaultLength, pending.transmission_type,
- HAS_RETRANSMITTABLE_DATA);
+ pending.transmission_type, HAS_RETRANSMITTABLE_DATA);
}
QuicSentPacketManager manager_;
@@ -1654,11 +1652,12 @@ TEST_F(QuicSentPacketManagerTest,
.WillOnce(Return(QuicTime::Delta::Zero()));
EXPECT_EQ(QuicTime::Delta::Zero(),
manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, BytesInFlight(), i, 1024,
- HAS_RETRANSMITTABLE_DATA))
+ EXPECT_CALL(*send_algorithm_,
+ OnPacketSent(_, BytesInFlight(), i, kDefaultLength,
+ HAS_RETRANSMITTABLE_DATA))
.WillOnce(Return(true));
SerializedPacket packet(CreatePacket(i, true));
- manager_.OnPacketSent(&packet, 0, clock_.Now(), 1024, NOT_RETRANSMISSION,
+ manager_.OnPacketSent(&packet, 0, clock_.Now(), NOT_RETRANSMISSION,
HAS_RETRANSMITTABLE_DATA);
}
EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
@@ -1677,11 +1676,12 @@ TEST_F(QuicSentPacketManagerTest, ReceiveWindowLimited) {
.WillOnce(Return(QuicTime::Delta::Zero()));
EXPECT_EQ(QuicTime::Delta::Zero(),
manager_.TimeUntilSend(clock_.Now(), HAS_RETRANSMITTABLE_DATA));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, BytesInFlight(), i, 1024,
- HAS_RETRANSMITTABLE_DATA))
+ EXPECT_CALL(*send_algorithm_,
+ OnPacketSent(_, BytesInFlight(), i, kDefaultLength,
+ HAS_RETRANSMITTABLE_DATA))
.WillOnce(Return(true));
SerializedPacket packet(CreatePacket(i, true));
- manager_.OnPacketSent(&packet, 0, clock_.Now(), 1024, NOT_RETRANSMISSION,
+ manager_.OnPacketSent(&packet, 0, clock_.Now(), NOT_RETRANSMISSION,
HAS_RETRANSMITTABLE_DATA);
}
EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
diff --git a/net/quic/quic_stream_sequencer.cc b/net/quic/quic_stream_sequencer.cc
index 1c4f580..18f40a3 100644
--- a/net/quic/quic_stream_sequencer.cc
+++ b/net/quic/quic_stream_sequencer.cc
@@ -49,6 +49,8 @@ void QuicStreamSequencer::OnStreamFrame(const QuicStreamFrame& frame) {
const size_t data_len = frame.frame_length;
if (data_len == 0 && !frame.fin) {
// Stream frames must have data or a fin flag.
+ LOG(WARNING) << "QUIC_INVALID_STREAM_FRAM: Empty stream frame "
+ "without FIN set.";
stream_->CloseConnectionWithDetails(QUIC_INVALID_STREAM_FRAME,
"Empty stream frame without FIN set.");
return;
@@ -66,6 +68,8 @@ void QuicStreamSequencer::OnStreamFrame(const QuicStreamFrame& frame) {
clock_->ApproximateNow(), &bytes_written);
if (result == QUIC_INVALID_STREAM_DATA) {
+ LOG(WARNING) << "QUIC_INVALID_STREAM_FRAME: Stream frame "
+ "overlaps with buffered data.";
stream_->CloseConnectionWithDetails(
QUIC_INVALID_STREAM_FRAME, "Stream frame overlaps with buffered data.");
return;
diff --git a/net/quic/quic_unacked_packet_map.cc b/net/quic/quic_unacked_packet_map.cc
index 2153c7c..c8a3250 100644
--- a/net/quic/quic_unacked_packet_map.cc
+++ b/net/quic/quic_unacked_packet_map.cc
@@ -35,9 +35,9 @@ void QuicUnackedPacketMap::AddSentPacket(SerializedPacket* packet,
QuicPacketNumber old_packet_number,
TransmissionType transmission_type,
QuicTime sent_time,
- QuicByteCount bytes_sent,
bool set_in_flight) {
QuicPacketNumber packet_number = packet->packet_number;
+ QuicPacketLength bytes_sent = packet->encrypted_length;
QUIC_BUG_IF(largest_sent_packet_ >= packet_number) << packet_number;
DCHECK_GE(packet_number, least_unacked_ + unacked_packets_.size());
while (least_unacked_ + unacked_packets_.size() < packet_number) {
diff --git a/net/quic/quic_unacked_packet_map.h b/net/quic/quic_unacked_packet_map.h
index be12491..8ed6d0a 100644
--- a/net/quic/quic_unacked_packet_map.h
+++ b/net/quic/quic_unacked_packet_map.h
@@ -37,7 +37,6 @@ class NET_EXPORT_PRIVATE QuicUnackedPacketMap {
QuicPacketNumber old_packet_number,
TransmissionType transmission_type,
QuicTime sent_time,
- QuicByteCount bytes_sent,
bool set_in_flight);
// Returns true if the packet |packet_number| is unacked.
diff --git a/net/quic/quic_unacked_packet_map_test.cc b/net/quic/quic_unacked_packet_map_test.cc
index a422db1..26a0043 100644
--- a/net/quic/quic_unacked_packet_map_test.cc
+++ b/net/quic/quic_unacked_packet_map_test.cc
@@ -18,7 +18,6 @@ namespace test {
namespace {
// Default packet length.
-const uint32_t kDefaultAckLength = 50;
const uint32_t kDefaultLength = 1000;
class QuicUnackedPacketMapTest : public ::testing::Test {
@@ -118,8 +117,7 @@ class QuicUnackedPacketMapTest : public ::testing::Test {
TEST_F(QuicUnackedPacketMapTest, RttOnly) {
// Acks are only tracked for RTT measurement purposes.
SerializedPacket packet(CreateNonRetransmittablePacket(1));
- unacked_packets_.AddSentPacket(&packet, 0, NOT_RETRANSMISSION, now_,
- kDefaultAckLength, false);
+ unacked_packets_.AddSentPacket(&packet, 0, NOT_RETRANSMISSION, now_, false);
QuicPacketNumber unacked[] = {1};
VerifyUnackedPackets(unacked, arraysize(unacked));
@@ -135,8 +133,7 @@ TEST_F(QuicUnackedPacketMapTest, RttOnly) {
TEST_F(QuicUnackedPacketMapTest, RetransmittableInflightAndRtt) {
// Simulate a retransmittable packet being sent and acked.
SerializedPacket packet(CreateRetransmittablePacket(1));
- unacked_packets_.AddSentPacket(&packet, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet, 0, NOT_RETRANSMISSION, now_, true);
QuicPacketNumber unacked[] = {1};
VerifyUnackedPackets(unacked, arraysize(unacked));
@@ -162,8 +159,7 @@ TEST_F(QuicUnackedPacketMapTest, RetransmittableInflightAndRtt) {
TEST_F(QuicUnackedPacketMapTest, StopRetransmission) {
const QuicStreamId stream_id = 2;
SerializedPacket packet(CreateRetransmittablePacketForStream(1, stream_id));
- unacked_packets_.AddSentPacket(&packet, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet, 0, NOT_RETRANSMISSION, now_, true);
QuicPacketNumber unacked[] = {1};
VerifyUnackedPackets(unacked, arraysize(unacked));
@@ -180,8 +176,7 @@ TEST_F(QuicUnackedPacketMapTest, StopRetransmission) {
TEST_F(QuicUnackedPacketMapTest, StopRetransmissionOnOtherStream) {
const QuicStreamId stream_id = 2;
SerializedPacket packet(CreateRetransmittablePacketForStream(1, stream_id));
- unacked_packets_.AddSentPacket(&packet, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet, 0, NOT_RETRANSMISSION, now_, true);
QuicPacketNumber unacked[] = {1};
VerifyUnackedPackets(unacked, arraysize(unacked));
@@ -199,11 +194,9 @@ TEST_F(QuicUnackedPacketMapTest, StopRetransmissionOnOtherStream) {
TEST_F(QuicUnackedPacketMapTest, StopRetransmissionAfterRetransmission) {
const QuicStreamId stream_id = 2;
SerializedPacket packet1(CreateRetransmittablePacketForStream(1, stream_id));
- unacked_packets_.AddSentPacket(&packet1, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet1, 0, NOT_RETRANSMISSION, now_, true);
SerializedPacket packet2(CreateNonRetransmittablePacket(2));
- unacked_packets_.AddSentPacket(&packet2, 1, LOSS_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet2, 1, LOSS_RETRANSMISSION, now_, true);
QuicPacketNumber unacked[] = {1, 2};
VerifyUnackedPackets(unacked, arraysize(unacked));
@@ -221,11 +214,9 @@ TEST_F(QuicUnackedPacketMapTest, RetransmittedPacket) {
// Simulate a retransmittable packet being sent, retransmitted, and the first
// transmission being acked.
SerializedPacket packet1(CreateRetransmittablePacket(1));
- unacked_packets_.AddSentPacket(&packet1, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet1, 0, NOT_RETRANSMISSION, now_, true);
SerializedPacket packet2(CreateNonRetransmittablePacket(2));
- unacked_packets_.AddSentPacket(&packet2, 1, LOSS_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet2, 1, LOSS_RETRANSMISSION, now_, true);
QuicPacketNumber unacked[] = {1, 2};
VerifyUnackedPackets(unacked, arraysize(unacked));
@@ -258,11 +249,9 @@ TEST_F(QuicUnackedPacketMapTest, RetransmittedPacket) {
TEST_F(QuicUnackedPacketMapTest, RetransmitThreeTimes) {
// Simulate a retransmittable packet being sent and retransmitted twice.
SerializedPacket packet1(CreateRetransmittablePacket(1));
- unacked_packets_.AddSentPacket(&packet1, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet1, 0, NOT_RETRANSMISSION, now_, true);
SerializedPacket packet2(CreateRetransmittablePacket(2));
- unacked_packets_.AddSentPacket(&packet2, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet2, 0, NOT_RETRANSMISSION, now_, true);
QuicPacketNumber unacked[] = {1, 2};
VerifyUnackedPackets(unacked, arraysize(unacked));
@@ -276,11 +265,9 @@ TEST_F(QuicUnackedPacketMapTest, RetransmitThreeTimes) {
unacked_packets_.RemoveRetransmittability(2);
unacked_packets_.RemoveFromInFlight(1);
SerializedPacket packet3(CreateNonRetransmittablePacket(3));
- unacked_packets_.AddSentPacket(&packet3, 1, LOSS_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet3, 1, LOSS_RETRANSMISSION, now_, true);
SerializedPacket packet4(CreateRetransmittablePacket(4));
- unacked_packets_.AddSentPacket(&packet4, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet4, 0, NOT_RETRANSMISSION, now_, true);
QuicPacketNumber unacked2[] = {1, 3, 4};
VerifyUnackedPackets(unacked2, arraysize(unacked2));
@@ -294,11 +281,9 @@ TEST_F(QuicUnackedPacketMapTest, RetransmitThreeTimes) {
unacked_packets_.RemoveFromInFlight(4);
unacked_packets_.RemoveRetransmittability(4);
SerializedPacket packet5(CreateNonRetransmittablePacket(5));
- unacked_packets_.AddSentPacket(&packet5, 3, LOSS_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet5, 3, LOSS_RETRANSMISSION, now_, true);
SerializedPacket packet6(CreateRetransmittablePacket(6));
- unacked_packets_.AddSentPacket(&packet6, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet6, 0, NOT_RETRANSMISSION, now_, true);
QuicPacketNumber unacked3[] = {3, 5, 6};
VerifyUnackedPackets(unacked3, arraysize(unacked3));
@@ -312,8 +297,7 @@ TEST_F(QuicUnackedPacketMapTest, RetransmitThreeTimes) {
unacked_packets_.RemoveFromInFlight(6);
unacked_packets_.RemoveRetransmittability(6);
SerializedPacket packet7(CreateNonRetransmittablePacket(7));
- unacked_packets_.AddSentPacket(&packet7, 5, LOSS_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet7, 5, LOSS_RETRANSMISSION, now_, true);
QuicPacketNumber unacked4[] = {3, 5, 7};
VerifyUnackedPackets(unacked4, arraysize(unacked4));
@@ -332,11 +316,9 @@ TEST_F(QuicUnackedPacketMapTest, RetransmitThreeTimes) {
TEST_F(QuicUnackedPacketMapTest, RetransmitFourTimes) {
// Simulate a retransmittable packet being sent and retransmitted twice.
SerializedPacket packet1(CreateRetransmittablePacket(1));
- unacked_packets_.AddSentPacket(&packet1, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet1, 0, NOT_RETRANSMISSION, now_, true);
SerializedPacket packet2(CreateRetransmittablePacket(2));
- unacked_packets_.AddSentPacket(&packet2, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet2, 0, NOT_RETRANSMISSION, now_, true);
QuicPacketNumber unacked[] = {1, 2};
VerifyUnackedPackets(unacked, arraysize(unacked));
@@ -350,8 +332,7 @@ TEST_F(QuicUnackedPacketMapTest, RetransmitFourTimes) {
unacked_packets_.RemoveRetransmittability(2);
unacked_packets_.RemoveFromInFlight(1);
SerializedPacket packet3(CreateNonRetransmittablePacket(3));
- unacked_packets_.AddSentPacket(&packet3, 1, LOSS_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet3, 1, LOSS_RETRANSMISSION, now_, true);
QuicPacketNumber unacked2[] = {1, 3};
VerifyUnackedPackets(unacked2, arraysize(unacked2));
@@ -362,11 +343,9 @@ TEST_F(QuicUnackedPacketMapTest, RetransmitFourTimes) {
// TLP 3 (formerly 1) as 4, and don't remove 1 from unacked.
SerializedPacket packet4(CreateNonRetransmittablePacket(4));
- unacked_packets_.AddSentPacket(&packet4, 3, TLP_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet4, 3, TLP_RETRANSMISSION, now_, true);
SerializedPacket packet5(CreateRetransmittablePacket(5));
- unacked_packets_.AddSentPacket(&packet5, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet5, 0, NOT_RETRANSMISSION, now_, true);
QuicPacketNumber unacked3[] = {1, 3, 4, 5};
VerifyUnackedPackets(unacked3, arraysize(unacked3));
@@ -382,8 +361,7 @@ TEST_F(QuicUnackedPacketMapTest, RetransmitFourTimes) {
unacked_packets_.RemoveFromInFlight(3);
unacked_packets_.RemoveFromInFlight(4);
SerializedPacket packet6(CreateNonRetransmittablePacket(6));
- unacked_packets_.AddSentPacket(&packet6, 4, LOSS_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet6, 4, LOSS_RETRANSMISSION, now_, true);
QuicPacketNumber unacked4[] = {4, 6};
VerifyUnackedPackets(unacked4, arraysize(unacked4));
@@ -397,14 +375,11 @@ TEST_F(QuicUnackedPacketMapTest, SendWithGap) {
// Simulate a retransmittable packet being sent, retransmitted, and the first
// transmission being acked.
SerializedPacket packet1(CreateRetransmittablePacket(1));
- unacked_packets_.AddSentPacket(&packet1, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet1, 0, NOT_RETRANSMISSION, now_, true);
SerializedPacket packet3(CreateRetransmittablePacket(3));
- unacked_packets_.AddSentPacket(&packet3, 0, NOT_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet3, 0, NOT_RETRANSMISSION, now_, true);
SerializedPacket packet5(CreateNonRetransmittablePacket(5));
- unacked_packets_.AddSentPacket(&packet5, 3, LOSS_RETRANSMISSION, now_,
- kDefaultLength, true);
+ unacked_packets_.AddSentPacket(&packet5, 3, LOSS_RETRANSMISSION, now_, true);
EXPECT_EQ(1u, unacked_packets_.GetLeastUnacked());
EXPECT_TRUE(unacked_packets_.IsUnacked(1));
diff --git a/net/quic/quic_utils.cc b/net/quic/quic_utils.cc
index e57440a..c6a5cda 100644
--- a/net/quic/quic_utils.cc
+++ b/net/quic/quic_utils.cc
@@ -56,6 +56,8 @@ uint128 IncrementalHashFast(uint128 uhash, const char* data, size_t len) {
}
#endif
+#ifndef QUIC_UTIL_HAS_UINT128
+// Slow implementation of IncrementalHash. In practice, only used by Chromium.
uint128 IncrementalHashSlow(uint128 hash, const char* data, size_t len) {
// kPrime = 309485009821345068724781371
static const uint128 kPrime(16777216, 315);
@@ -66,12 +68,11 @@ uint128 IncrementalHashSlow(uint128 hash, const char* data, size_t len) {
}
return hash;
}
+#endif
uint128 IncrementalHash(uint128 hash, const char* data, size_t len) {
#ifdef QUIC_UTIL_HAS_UINT128
- return FLAGS_quic_utils_use_fast_incremental_hash
- ? IncrementalHashFast(hash, data, len)
- : IncrementalHashSlow(hash, data, len);
+ return IncrementalHashFast(hash, data, len);
#else
return IncrementalHashSlow(hash, data, len);
#endif
diff --git a/net/quic/quic_utils_test.cc b/net/quic/quic_utils_test.cc
index d4b99fd..7412a24 100644
--- a/net/quic/quic_utils_test.cc
+++ b/net/quic/quic_utils_test.cc
@@ -175,19 +175,7 @@ uint128 IncrementalHashReference(const void* data, size_t len) {
return hash;
}
-TEST(QuicUtilsHashTest, ReferenceTestSlow) {
- FLAGS_quic_utils_use_fast_incremental_hash = false;
- std::vector<uint8_t> data(32);
- for (size_t i = 0; i < data.size(); ++i) {
- data[i] = i % 255;
- }
- EXPECT_EQ(IncrementalHashReference(data.data(), data.size()),
- QuicUtils::FNV1a_128_Hash(
- reinterpret_cast<const char*>(data.data()), data.size()));
-}
-
-TEST(QuicUtilsHashTest, ReferenceTestFast) {
- FLAGS_quic_utils_use_fast_incremental_hash = true;
+TEST(QuicUtilsHashTest, ReferenceTest) {
std::vector<uint8_t> data(32);
for (size_t i = 0; i < data.size(); ++i) {
data[i] = i % 255;
diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc
index c94b092..9911757 100644
--- a/net/quic/test_tools/quic_test_utils.cc
+++ b/net/quic/test_tools/quic_test_utils.cc
@@ -300,7 +300,7 @@ void PacketSavingConnection::SendOrQueuePacket(SerializedPacket* packet) {
QuicUtils::CopyBuffer(*packet), packet->encrypted_length, true));
// Transfer ownership of the packet to the SentPacketManager and the
// ack notifier to the AckNotifierManager.
- sent_packet_manager_.OnPacketSent(packet, 0, QuicTime::Zero(), 1000,
+ sent_packet_manager_.OnPacketSent(packet, 0, QuicTime::Zero(),
NOT_RETRANSMISSION,
HAS_RETRANSMITTABLE_DATA);
}
diff --git a/net/quic/test_tools/quic_test_utils.h b/net/quic/test_tools/quic_test_utils.h
index 729a6d1..d29d667 100644
--- a/net/quic/test_tools/quic_test_utils.h
+++ b/net/quic/test_tools/quic_test_utils.h
@@ -709,11 +709,10 @@ class MockQuicConnectionDebugVisitor : public QuicConnectionDebugVisitor {
MOCK_METHOD1(OnFrameAddedToPacket, void(const QuicFrame&));
- MOCK_METHOD5(OnPacketSent,
+ MOCK_METHOD4(OnPacketSent,
void(const SerializedPacket&,
QuicPacketNumber,
TransmissionType,
- size_t encrypted_length,
QuicTime));
MOCK_METHOD3(OnPacketReceived,
diff --git a/net/tools/quic/quic_client_session.cc b/net/tools/quic/quic_client_session.cc
index ce1d8b6..ba0f0ed 100644
--- a/net/tools/quic/quic_client_session.cc
+++ b/net/tools/quic/quic_client_session.cc
@@ -38,20 +38,27 @@ void QuicClientSession::OnProofValid(
void QuicClientSession::OnProofVerifyDetailsAvailable(
const ProofVerifyDetails& /*verify_details*/) {}
-QuicSpdyClientStream* QuicClientSession::CreateOutgoingDynamicStream(
- SpdyPriority priority) {
+bool QuicClientSession::ShouldCreateOutgoingDynamicStream() {
if (!crypto_stream_->encryption_established()) {
DVLOG(1) << "Encryption not active so no outgoing stream created.";
- return nullptr;
+ return false;
}
if (GetNumOpenOutgoingStreams() >= max_open_outgoing_streams()) {
DVLOG(1) << "Failed to create a new outgoing stream. "
<< "Already " << GetNumOpenOutgoingStreams() << " open.";
- return nullptr;
+ return false;
}
if (goaway_received() && respect_goaway_) {
DVLOG(1) << "Failed to create a new outgoing stream. "
<< "Already received goaway.";
+ return false;
+ }
+ return true;
+}
+
+QuicSpdyClientStream* QuicClientSession::CreateOutgoingDynamicStream(
+ SpdyPriority priority) {
+ if (!ShouldCreateOutgoingDynamicStream()) {
return nullptr;
}
QuicSpdyClientStream* stream = CreateClientStream();
diff --git a/net/tools/quic/quic_client_session.h b/net/tools/quic/quic_client_session.h
index 22146e7..2cbf236 100644
--- a/net/tools/quic/quic_client_session.h
+++ b/net/tools/quic/quic_client_session.h
@@ -74,7 +74,12 @@ class QuicClientSession : public QuicClientSessionBase {
QuicCryptoClientConfig* crypto_config() { return crypto_config_; }
private:
+ // If an outgoing stream can be created, return true.
+ bool ShouldCreateOutgoingDynamicStream();
+
+ // If an incoming stream can be created, return true.
bool ShouldCreateIncomingDynamicStream(QuicStreamId id);
+
scoped_ptr<QuicCryptoClientStreamBase> crypto_stream_;
QuicServerId server_id_;
QuicCryptoClientConfig* crypto_config_;
diff --git a/net/tools/quic/quic_packet_reader.cc b/net/tools/quic/quic_packet_reader.cc
index 249441c..a4ba1be 100644
--- a/net/tools/quic/quic_packet_reader.cc
+++ b/net/tools/quic/quic_packet_reader.cc
@@ -37,22 +37,22 @@ QuicPacketReader::QuicPacketReader() {
void QuicPacketReader::Initialize() {
#if MMSG_MORE
// Zero initialize uninitialized memory.
- memset(cbuf_, 0, arraysize(cbuf_));
- memset(buf_, 0, arraysize(buf_));
- memset(raw_address_, 0, sizeof(raw_address_));
memset(mmsg_hdr_, 0, sizeof(mmsg_hdr_));
for (int i = 0; i < kNumPacketsPerReadMmsgCall; ++i) {
- iov_[i].iov_base = buf_ + (kMaxPacketSize * i);
- iov_[i].iov_len = kMaxPacketSize;
+ packets_[i].iov.iov_base = packets_[i].buf;
+ packets_[i].iov.iov_len = kMaxPacketSize;
+ memset(&packets_[i].raw_address, 0, sizeof(packets_[i].raw_address));
+ memset(packets_[i].cbuf, 0, sizeof(packets_[i].cbuf));
+ memset(packets_[i].buf, 0, sizeof(packets_[i].buf));
msghdr* hdr = &mmsg_hdr_[i].msg_hdr;
- hdr->msg_name = &raw_address_[i];
+ hdr->msg_name = &packets_[i].raw_address;
hdr->msg_namelen = sizeof(sockaddr_storage);
- hdr->msg_iov = &iov_[i];
+ hdr->msg_iov = &packets_[i].iov;
hdr->msg_iovlen = 1;
- hdr->msg_control = cbuf_ + kSpaceForOverflowAndIp * i;
+ hdr->msg_control = packets_[i].cbuf;
hdr->msg_controllen = kSpaceForOverflowAndIp;
}
#endif
@@ -70,11 +70,10 @@ bool QuicPacketReader::ReadAndDispatchPackets(
#if MMSG_MORE
// Re-set the length fields in case recvmmsg has changed them.
for (int i = 0; i < kNumPacketsPerReadMmsgCall; ++i) {
- iov_[i].iov_len = kMaxPacketSize;
- mmsg_hdr_[i].msg_len = 0;
+ DCHECK_EQ(kMaxPacketSize, packets_[i].iov.iov_len);
msghdr* hdr = &mmsg_hdr_[i].msg_hdr;
hdr->msg_namelen = sizeof(sockaddr_storage);
- hdr->msg_iovlen = 1;
+ DCHECK_EQ(1, hdr->msg_iovlen);
hdr->msg_controllen = kSpaceForOverflowAndIp;
}
@@ -90,7 +89,7 @@ bool QuicPacketReader::ReadAndDispatchPackets(
continue;
}
- IPEndPoint client_address = IPEndPoint(raw_address_[i]);
+ IPEndPoint client_address = IPEndPoint(packets_[i].raw_address);
IPAddressNumber server_ip =
QuicSocketUtils::GetAddressFromMsghdr(&mmsg_hdr_[i].msg_hdr);
if (!IsInitializedAddress(server_ip)) {
@@ -98,8 +97,9 @@ bool QuicPacketReader::ReadAndDispatchPackets(
continue;
}
- QuicEncryptedPacket packet(reinterpret_cast<char*>(iov_[i].iov_base),
- mmsg_hdr_[i].msg_len, false);
+ QuicEncryptedPacket packet(
+ reinterpret_cast<char*>(packets_[i].iov.iov_base), mmsg_hdr_[i].msg_len,
+ false);
IPEndPoint server_address(server_ip, port);
processor->ProcessPacket(server_address, client_address, packet);
}
diff --git a/net/tools/quic/quic_packet_reader.h b/net/tools/quic/quic_packet_reader.h
index 726f449..22a6f49 100644
--- a/net/tools/quic/quic_packet_reader.h
+++ b/net/tools/quic/quic_packet_reader.h
@@ -61,18 +61,23 @@ class QuicPacketReader {
// Storage only used when recvmmsg is available.
#if MMSG_MORE
- // cbuf_ is used for ancillary data from the kernel on recvmmsg.
- char cbuf_[kSpaceForOverflowAndIp * kNumPacketsPerReadMmsgCall];
- // buf_ is used for the data read from the kernel on recvmmsg.
// TODO(danzh): change it to be a pointer to avoid the allocation on the stack
// from exceeding maximum allowed frame size.
- char buf_[kMaxPacketSize * kNumPacketsPerReadMmsgCall];
- // iov_ and mmsg_hdr_ are used to supply cbuf and buf to the recvmmsg call.
- iovec iov_[kNumPacketsPerReadMmsgCall];
+ // packets_ and mmsg_hdr_ are used to supply cbuf and buf to the recvmmsg
+ // call.
+
+ struct PacketData {
+ iovec iov;
+ // raw_address is used for address information provided by the recvmmsg
+ // call on the packets.
+ struct sockaddr_storage raw_address;
+ // cbuf is used for ancillary data from the kernel on recvmmsg.
+ char cbuf[kSpaceForOverflowAndIp];
+ // buf is used for the data read from the kernel on recvmmsg.
+ char buf[kMaxPacketSize];
+ };
+ PacketData packets_[kNumPacketsPerReadMmsgCall];
mmsghdr mmsg_hdr_[kNumPacketsPerReadMmsgCall];
- // raw_address_ is used for address information provided by the recvmmsg
- // call on the packets.
- struct sockaddr_storage raw_address_[kNumPacketsPerReadMmsgCall];
#endif
DISALLOW_COPY_AND_ASSIGN(QuicPacketReader);