| Index: net/tools/quic/quic_dispatcher.cc
|
| diff --git a/net/tools/quic/quic_dispatcher.cc b/net/tools/quic/quic_dispatcher.cc
|
| index bd691ce2dad989bfb5f40b896617d65e186579d2..23373d00aa9b1cafdf005e70e79e18851fe02ce6 100644
|
| --- a/net/tools/quic/quic_dispatcher.cc
|
| +++ b/net/tools/quic/quic_dispatcher.cc
|
| @@ -211,7 +211,8 @@ QuicDispatcher::QuicDispatcher(
|
| /*unused*/ QuicTime::Zero(),
|
| Perspective::IS_SERVER),
|
| last_error_(QUIC_NO_ERROR),
|
| - new_sessions_allowed_per_event_loop_(0u) {
|
| + new_sessions_allowed_per_event_loop_(0u),
|
| + accept_new_connections_(true) {
|
| framer_.set_visitor(this);
|
| }
|
|
|
| @@ -363,7 +364,7 @@ void QuicDispatcher::ProcessUnauthenticatedHeaderFate(
|
| QuicPacketNumber packet_number) {
|
| switch (fate) {
|
| case kFateProcess: {
|
| - ProcessChlo();
|
| + ProcessChlo(packet_number);
|
| break;
|
| }
|
| case kFateTimeWait:
|
| @@ -449,6 +450,10 @@ void QuicDispatcher::CleanUpSession(SessionMap::iterator it,
|
| session_map_.erase(it);
|
| }
|
|
|
| +void QuicDispatcher::StopAcceptingNewConnections() {
|
| + accept_new_connections_ = false;
|
| +}
|
| +
|
| void QuicDispatcher::DeleteSessions() {
|
| closed_session_list_.clear();
|
| }
|
| @@ -710,7 +715,19 @@ void QuicDispatcher::BufferEarlyPacket(QuicConnectionId connection_id) {
|
| }
|
| }
|
|
|
| -void QuicDispatcher::ProcessChlo() {
|
| +void QuicDispatcher::ProcessChlo(QuicPacketNumber packet_number) {
|
| + if (!accept_new_connections_) {
|
| + // Don't any create new connection.
|
| + time_wait_list_manager()->AddConnectionIdToTimeWait(
|
| + current_connection_id(), framer()->version(),
|
| + /*connection_rejected_statelessly=*/false,
|
| + /*termination_packets=*/nullptr);
|
| + // This will trigger sending Public Reset packet.
|
| + time_wait_list_manager()->ProcessPacket(
|
| + current_server_address(), current_client_address(),
|
| + current_connection_id(), packet_number, current_packet());
|
| + return;
|
| + }
|
| if (FLAGS_quic_reloadable_flag_quic_create_session_after_insertion &&
|
| !buffered_packets_.HasBufferedPackets(current_connection_id_) &&
|
| !ShouldCreateOrBufferPacketForConnection(current_connection_id_)) {
|
|
|