Revved to chromium 4dfb55c9cf0950b8bac8b10070c9b8f3e7de66c2 refs/remotes/origin/HEAD
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
index 8d49010..f684cf2 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -6,6 +6,7 @@
#include <string.h>
#include <sys/types.h>
+
#include <algorithm>
#include <iterator>
#include <limits>
@@ -53,10 +54,6 @@
// that this becomes limiting, we can revisit.
const size_t kMaxFecGroups = 2;
-// Limit the number of undecryptable packets we buffer in
-// expectation of the CHLO/SHLO arriving.
-const size_t kMaxUndecryptablePackets = 10;
-
// Maximum number of acks received before sending an ack in response.
const size_t kMaxPacketsReceivedBeforeAckSend = 20;
@@ -72,7 +69,7 @@
: connection_(connection) {
}
- virtual QuicTime OnAlarm() OVERRIDE {
+ virtual QuicTime OnAlarm() override {
connection_->SendAck();
return QuicTime::Zero();
}
@@ -92,7 +89,7 @@
: connection_(connection) {
}
- virtual QuicTime OnAlarm() OVERRIDE {
+ virtual QuicTime OnAlarm() override {
connection_->OnRetransmissionTimeout();
return QuicTime::Zero();
}
@@ -111,7 +108,7 @@
: connection_(connection) {
}
- virtual QuicTime OnAlarm() OVERRIDE {
+ virtual QuicTime OnAlarm() override {
connection_->WriteIfNotBlocked();
// Never reschedule the alarm, since CanWrite does that.
return QuicTime::Zero();
@@ -129,7 +126,7 @@
: connection_(connection) {
}
- virtual QuicTime OnAlarm() OVERRIDE {
+ virtual QuicTime OnAlarm() override {
connection_->CheckForTimeout();
// Never reschedule the alarm, since CheckForTimeout does that.
return QuicTime::Zero();
@@ -147,7 +144,7 @@
: connection_(connection) {
}
- virtual QuicTime OnAlarm() OVERRIDE {
+ virtual QuicTime OnAlarm() override {
connection_->SendPing();
return QuicTime::Zero();
}
@@ -162,10 +159,10 @@
QuicConnection::QueuedPacket::QueuedPacket(SerializedPacket packet,
EncryptionLevel level)
- : serialized_packet(packet),
- encryption_level(level),
- transmission_type(NOT_RETRANSMISSION),
- original_sequence_number(0) {
+ : serialized_packet(packet),
+ encryption_level(level),
+ transmission_type(NOT_RETRANSMISSION),
+ original_sequence_number(0) {
}
QuicConnection::QueuedPacket::QueuedPacket(
@@ -204,6 +201,7 @@
last_decrypted_packet_level_(ENCRYPTION_NONE),
largest_seen_packet_with_ack_(0),
largest_seen_packet_with_stop_waiting_(0),
+ max_undecryptable_packets_(0),
pending_version_negotiation_packet_(false),
received_packet_manager_(&stats_),
ack_queued_(false),
@@ -271,6 +269,7 @@
SetIdleNetworkTimeout(config.IdleConnectionStateLifetime());
}
sent_packet_manager_.SetFromConfig(config);
+ max_undecryptable_packets_ = config.max_undecryptable_packets();
}
bool QuicConnection::SelectMutualVersion(
@@ -1116,7 +1115,7 @@
// because the CHLO or SHLO packet was lost.
if (framer_.error() == QUIC_DECRYPTION_FAILURE) {
if (encryption_level_ != ENCRYPTION_FORWARD_SECURE &&
- undecryptable_packets_.size() < kMaxUndecryptablePackets) {
+ undecryptable_packets_.size() < max_undecryptable_packets_) {
QueueUndecryptablePacket(packet);
} else if (debug_visitor_.get() != nullptr) {
debug_visitor_->OnUndecryptablePacket();
@@ -1176,8 +1175,7 @@
return;
}
- { // Limit the scope of the bundler.
- // Set |include_ack| to false in bundler; ack inclusion happens elsewhere.
+ { // Limit the scope of the bundler. ACK inclusion happens elsewhere.
ScopedPacketBundler bundler(this, NO_ACK);
visitor_->OnCanWrite();
}
@@ -1322,7 +1320,8 @@
// If the scheduler requires a delay, then we can not send this packet now.
if (!delay.IsZero()) {
send_alarm_->Update(now.Add(delay), QuicTime::Delta::FromMilliseconds(1));
- DVLOG(1) << "Delaying sending.";
+ DVLOG(1) << ENDPOINT << "Delaying sending " << delay.ToMilliseconds()
+ << "ms";
return false;
}
send_alarm_->Cancel();
@@ -1408,15 +1407,6 @@
if (result.error_code == ERR_IO_PENDING) {
DCHECK_EQ(WRITE_STATUS_BLOCKED, result.status);
}
- if (debug_visitor_.get() != nullptr) {
- // Pass the write result to the visitor.
- debug_visitor_->OnPacketSent(sequence_number,
- packet->original_sequence_number,
- packet->encryption_level,
- packet->transmission_type,
- *encrypted,
- result);
- }
if (result.status == WRITE_STATUS_BLOCKED) {
visitor_->OnWriteBlocked();
@@ -1429,6 +1419,15 @@
}
}
QuicTime now = clock_->Now();
+ if (result.status != WRITE_STATUS_ERROR && debug_visitor_.get() != nullptr) {
+ // Pass the write result to the visitor.
+ debug_visitor_->OnPacketSent(packet->serialized_packet,
+ packet->original_sequence_number,
+ packet->encryption_level,
+ packet->transmission_type,
+ *encrypted,
+ now);
+ }
if (packet->transmission_type == NOT_RETRANSMISSION) {
time_of_last_sent_new_packet_ = now;
}
@@ -1857,7 +1856,7 @@
// Adjust the idle timeout on client and server to prevent clients from
// sending requests to servers which have already closed the connection.
if (is_server_) {
- timeout = timeout.Add(QuicTime::Delta::FromSeconds(1));
+ timeout = timeout.Add(QuicTime::Delta::FromSeconds(3));
} else if (timeout > QuicTime::Delta::FromSeconds(1)) {
timeout = timeout.Subtract(QuicTime::Delta::FromSeconds(1));
}
@@ -1895,7 +1894,7 @@
// Adjust the idle timeout on client and server to prevent clients from
// sending requests to servers which have already closed the connection.
if (is_server_) {
- idle_timeout = idle_timeout.Add(QuicTime::Delta::FromSeconds(1));
+ idle_timeout = idle_timeout.Add(QuicTime::Delta::FromSeconds(3));
} else if (idle_timeout > QuicTime::Delta::FromSeconds(1)) {
idle_timeout = idle_timeout.Subtract(QuicTime::Delta::FromSeconds(1));
}