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

Unified Diff: net/quic/quic_connection.cc

Issue 2104633002: Landing recent QUIC changes until 6/24/2016 14:00 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection.cc
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
index d3d98bfcf0ff3174ddc0ce7fe9b55adace37e980..c5290627776318ae666da1feaef253a66fc17f5a 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -318,6 +318,8 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
framer_.set_received_entropy_calculator(&received_packet_manager_);
last_stop_waiting_frame_.least_unacked = 0;
stats_.connection_creation_time = clock_->ApproximateNow();
+ // TODO(ianswett): Supply the NetworkChangeVisitor as a constructor argument
+ // and make it required non-null, because it's always used.
sent_packet_manager_->SetNetworkChangeVisitor(this);
// Allow the packet writer to potentially reduce the packet size to a value
// even smaller than kDefaultMaxPacketSize.
@@ -698,8 +700,7 @@ bool QuicConnection::OnStreamFrame(const QuicStreamFrame& frame) {
}
if (frame.stream_id != kCryptoStreamId &&
last_decrypted_packet_level_ == ENCRYPTION_NONE) {
- if (FLAGS_quic_detect_memory_corrpution &&
- MaybeConsiderAsMemoryCorruption(frame)) {
+ if (MaybeConsiderAsMemoryCorruption(frame)) {
CloseConnection(QUIC_MAYBE_CORRUPTED_MEMORY,
"Received crypto frame on non crypto stream.",
ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
@@ -1680,12 +1681,14 @@ bool QuicConnection::WritePacket(SerializedPacket* packet) {
DVLOG(1) << ENDPOINT << "time we began writing last sent packet: "
<< packet_send_time.ToDebuggingValue();
- // TODO(ianswett): Change the packet number length and other packet creator
- // options by a more explicit API than setting a struct value directly,
- // perhaps via the NetworkChangeVisitor.
- packet_generator_.UpdateSequenceNumberLength(
- sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id),
- sent_packet_manager_->EstimateMaxPacketsInFlight(max_packet_length()));
+ if (!FLAGS_quic_simple_packet_number_length) {
+ // TODO(ianswett): Change the packet number length and other packet creator
+ // options by a more explicit API than setting a struct value directly,
+ // perhaps via the NetworkChangeVisitor.
+ packet_generator_.UpdateSequenceNumberLength(
+ sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id),
+ sent_packet_manager_->EstimateMaxPacketsInFlight(max_packet_length()));
+ }
bool reset_retransmission_alarm = sent_packet_manager_->OnPacketSent(
packet, packet->original_path_id, packet->original_packet_number,
@@ -1695,6 +1698,14 @@ bool QuicConnection::WritePacket(SerializedPacket* packet) {
SetRetransmissionAlarm();
}
+ if (FLAGS_quic_simple_packet_number_length) {
+ // The packet number length must be updated after OnPacketSent, because it
+ // may change the packet number length in packet.
+ packet_generator_.UpdateSequenceNumberLength(
+ sent_packet_manager_->GetLeastPacketAwaitedByPeer(packet->path_id),
+ sent_packet_manager_->EstimateMaxPacketsInFlight(max_packet_length()));
+ }
+
stats_.bytes_sent += result.bytes_written;
++stats_.packets_sent;
if (packet->transmission_type != NOT_RETRANSMISSION) {
@@ -1807,6 +1818,13 @@ void QuicConnection::OnPathDegrading() {
visitor_->OnPathDegrading();
}
+void QuicConnection::OnPathMtuIncreased(QuicPacketLength packet_size) {
+ DCHECK(FLAGS_quic_no_mtu_discovery_ack_listener);
+ if (packet_size > max_packet_length()) {
+ SetMaxPacketLength(packet_size);
+ }
+}
+
void QuicConnection::OnHandshakeComplete() {
sent_packet_manager_->SetHandshakeConfirmed();
// The client should immediately ack the SHLO to confirm the handshake is
@@ -2372,19 +2390,21 @@ void QuicConnection::SendMtuDiscoveryPacket(QuicByteCount target_mtu) {
// Send the probe.
packet_generator_.GenerateMtuDiscoveryPacket(
- target_mtu, last_mtu_discovery_ack_listener.get());
+ target_mtu, FLAGS_quic_no_mtu_discovery_ack_listener
+ ? nullptr
+ : last_mtu_discovery_ack_listener.get());
}
void QuicConnection::DiscoverMtu() {
DCHECK(!mtu_discovery_alarm_->IsSet());
- // Chcek if the MTU has been already increased.
+ // Check if the MTU has been already increased.
if (mtu_discovery_target_ <= max_packet_length()) {
return;
}
- // Schedule the next probe *before* sending the current one. This is
- // important, otherwise, when SendMtuDiscoveryPacket() is called,
+ // Calculate the packet number of the next probe *before* sending the current
+ // one. Otherwise, when SendMtuDiscoveryPacket() is called,
// MaybeSetMtuAlarm() will not realize that the probe has been just sent, and
// will reschedule this probe again.
packets_between_mtu_probes_ *= 2;
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698