Index: net/tools/quic/quic_dispatcher.cc |
diff --git a/net/tools/quic/quic_dispatcher.cc b/net/tools/quic/quic_dispatcher.cc |
index 70f2af14411122c07acea6ae675d938966a3482a..b4826907cb75cde2b9908e6f60e29c0a54f0e26a 100644 |
--- a/net/tools/quic/quic_dispatcher.cc |
+++ b/net/tools/quic/quic_dispatcher.cc |
@@ -200,6 +200,7 @@ QuicDispatcher::QuicDispatcher( |
alarm_factory_(std::move(alarm_factory)), |
delete_sessions_alarm_( |
alarm_factory_->CreateAlarm(new DeleteSessionsAlarm(this))), |
+ buffered_packets_(this, helper_->GetClock(), alarm_factory_.get()), |
supported_versions_(supported_versions), |
disable_quic_pre_30_(FLAGS_quic_disable_pre_30), |
allowed_supported_versions_(supported_versions), |
@@ -260,6 +261,7 @@ bool QuicDispatcher::OnUnauthenticatedPublicHeader( |
QuicConnectionId connection_id = header.connection_id; |
SessionMap::iterator it = session_map_.find(connection_id); |
if (it != session_map_.end()) { |
+ DCHECK(!buffered_packets_.HasBufferedPackets(connection_id)); |
it->second->ProcessUdpPacket(current_server_address_, |
current_client_address_, *current_packet_); |
return false; |
@@ -334,6 +336,16 @@ bool QuicDispatcher::OnUnauthenticatedHeader(const QuicPacketHeader& header) { |
session_map_.insert(std::make_pair(connection_id, session)); |
session->ProcessUdpPacket(current_server_address_, |
current_client_address_, *current_packet_); |
+ std::list<QuicBufferedPacketStore::BufferedPacket> packets = |
+ buffered_packets_.DeliverPackets(connection_id); |
+ for (const auto& packet : packets) { |
+ SessionMap::iterator it = session_map_.find(connection_id); |
+ if (it == session_map_.end()) { |
+ break; |
+ } |
+ it->second->ProcessUdpPacket(packet.server_address, |
+ packet.client_address, *packet.packet); |
+ } |
break; |
} |
case kFateTimeWait: |
@@ -594,6 +606,10 @@ void QuicDispatcher::OnPacketComplete() { |
DCHECK(false); |
} |
+void QuicDispatcher::OnExpiredPackets( |
+ QuicConnectionId connection_id, |
+ QuicBufferedPacketStore::BufferedPacketList early_arrived_packets) {} |
+ |
QuicServerSessionBase* QuicDispatcher::CreateQuicSession( |
QuicConnectionId connection_id, |
const IPEndPoint& client_address) { |
@@ -673,9 +689,10 @@ QuicDispatcher::QuicPacketFate QuicDispatcher::MaybeRejectStatelessly( |
&rejector); |
if (!ChloExtractor::Extract(*current_packet_, supported_versions_, |
&validator)) { |
- // TODO(rch): Since there was no CHLO in this packet, buffer it until one |
- // arrives. |
- DLOG(ERROR) << "Dropping undecryptable packet."; |
+ DVLOG(1) << "Buffering undecryptable packet."; |
+ buffered_packets_.EnqueuePacket(connection_id, *current_packet_, |
+ current_server_address_, |
+ current_client_address_); |
return kFateDrop; |
} |