| Index: net/quic/quic_connection.cc
|
| diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
|
| index c33aec55e26698650b0069184588f3446a9f8ac3..74d175802e2bce2291396518d1ae5ba7ec02fb0e 100644
|
| --- a/net/quic/quic_connection.cc
|
| +++ b/net/quic/quic_connection.cc
|
| @@ -192,7 +192,8 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
|
| bool is_server,
|
| bool is_secure,
|
| const QuicVersionVector& supported_versions)
|
| - : framer_(supported_versions, helper->GetClock()->ApproximateNow(),
|
| + : framer_(supported_versions,
|
| + helper->GetClock()->ApproximateNow(),
|
| is_server),
|
| helper_(helper),
|
| writer_(writer_factory.Create(this)),
|
| @@ -213,6 +214,7 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
|
| largest_seen_packet_with_stop_waiting_(0),
|
| max_undecryptable_packets_(0),
|
| pending_version_negotiation_packet_(false),
|
| + silent_close_enabled_(false),
|
| received_packet_manager_(&stats_),
|
| ack_queued_(false),
|
| num_packets_received_since_last_ack_sent_(0),
|
| @@ -230,7 +232,9 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
|
| time_of_last_sent_new_packet_(clock_->ApproximateNow()),
|
| sequence_number_of_last_sent_packet_(0),
|
| sent_packet_manager_(
|
| - is_server, clock_, &stats_,
|
| + is_server,
|
| + clock_,
|
| + &stats_,
|
| FLAGS_quic_use_bbr_congestion_control ? kBBR : kCubic,
|
| FLAGS_quic_use_time_loss_detection ? kTime : kNack,
|
| is_secure),
|
| @@ -268,6 +272,9 @@ void QuicConnection::SetFromConfig(const QuicConfig& config) {
|
| if (config.negotiated()) {
|
| SetNetworkTimeouts(QuicTime::Delta::Infinite(),
|
| config.IdleConnectionStateLifetime());
|
| + if (FLAGS_quic_allow_silent_close && config.SilentClose()) {
|
| + silent_close_enabled_ = true;
|
| + }
|
| } else {
|
| SetNetworkTimeouts(config.max_time_before_crypto_handshake(),
|
| config.max_idle_time_before_crypto_handshake());
|
| @@ -313,14 +320,8 @@ bool QuicConnection::SelectMutualVersion(
|
| void QuicConnection::OnError(QuicFramer* framer) {
|
| // Packets that we can not or have not decrypted are dropped.
|
| // TODO(rch): add stats to measure this.
|
| - if (FLAGS_quic_drop_junk_packets) {
|
| - if (!connected_ || last_packet_decrypted_ == false) {
|
| - return;
|
| - }
|
| - } else {
|
| - if (!connected_ || framer->error() == QUIC_DECRYPTION_FAILURE) {
|
| - return;
|
| - }
|
| + if (!connected_ || last_packet_decrypted_ == false) {
|
| + return;
|
| }
|
| SendConnectionCloseWithDetails(framer->error(), framer->detailed_error());
|
| }
|
| @@ -1854,6 +1855,12 @@ void QuicConnection::SendConnectionClosePacket(QuicErrorCode error,
|
| DVLOG(1) << ENDPOINT << "Force closing " << connection_id()
|
| << " with error " << QuicUtils::ErrorToString(error)
|
| << " (" << error << ") " << details;
|
| + // Don't send explicit connection close packets for timeouts.
|
| + // This is particularly important on mobile, where connections are short.
|
| + if (silent_close_enabled_ &&
|
| + error == QuicErrorCode::QUIC_CONNECTION_TIMED_OUT) {
|
| + return;
|
| + }
|
| ScopedPacketBundler ack_bundler(this, SEND_ACK);
|
| QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame();
|
| frame->error_code = error;
|
|
|