Index: net/quic/quic_connection.cc |
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc |
index fd487eb1ced2905e371bb89524918304bd41bd9e..472ee9b7f6f5a9b8a174055525d831a10b2c61e8 100644 |
--- a/net/quic/quic_connection.cc |
+++ b/net/quic/quic_connection.cc |
@@ -196,6 +196,7 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id, |
connection_id_(connection_id), |
peer_address_(address), |
migrating_peer_port_(0), |
+ last_packet_decrypted_(false), |
last_packet_revived_(false), |
last_size_(0), |
last_decrypted_packet_level_(ENCRYPTION_NONE), |
@@ -291,10 +292,16 @@ bool QuicConnection::SelectMutualVersion( |
} |
void QuicConnection::OnError(QuicFramer* framer) { |
- // Packets that we cannot decrypt are dropped. |
+ // Packets that we can not or have not decrypted are dropped. |
// TODO(rch): add stats to measure this. |
- if (!connected_ || framer->error() == QUIC_DECRYPTION_FAILURE) { |
- return; |
+ if (FLAGS_quic_drop_junk_packets) { |
+ if (!connected_ || last_packet_decrypted_ == false) { |
+ return; |
+ } |
+ } else { |
+ if (!connected_ || framer->error() == QUIC_DECRYPTION_FAILURE) { |
+ return; |
+ } |
} |
SendConnectionCloseWithDetails(framer->error(), framer->detailed_error()); |
} |
@@ -310,6 +317,8 @@ void QuicConnection::OnPacket() { |
last_blocked_frames_.empty() && |
last_ping_frames_.empty() && |
last_close_frames_.empty()); |
+ last_packet_decrypted_ = false; |
+ last_packet_revived_ = false; |
} |
void QuicConnection::OnPublicResetPacket( |
@@ -435,6 +444,7 @@ bool QuicConnection::OnUnauthenticatedHeader(const QuicPacketHeader& header) { |
void QuicConnection::OnDecryptedPacket(EncryptionLevel level) { |
last_decrypted_packet_level_ = level; |
+ last_packet_decrypted_ = true; |
} |
bool QuicConnection::OnPacketHeader(const QuicPacketHeader& header) { |
@@ -1102,7 +1112,6 @@ void QuicConnection::ProcessUdpPacket(const IPEndPoint& self_address, |
if (debug_visitor_.get() != nullptr) { |
debug_visitor_->OnPacketReceived(self_address, peer_address, packet); |
} |
- last_packet_revived_ = false; |
last_size_ = packet.length(); |
CheckForAddressMigration(self_address, peer_address); |