| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/tools/quic/quic_dispatcher.h" | 5 #include "net/tools/quic/quic_dispatcher.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 class StatelessConnectionTerminator { | 83 class StatelessConnectionTerminator { |
| 84 public: | 84 public: |
| 85 StatelessConnectionTerminator(QuicConnectionId connection_id, | 85 StatelessConnectionTerminator(QuicConnectionId connection_id, |
| 86 QuicFramer* framer, | 86 QuicFramer* framer, |
| 87 QuicConnectionHelperInterface* helper, | 87 QuicConnectionHelperInterface* helper, |
| 88 QuicTimeWaitListManager* time_wait_list_manager) | 88 QuicTimeWaitListManager* time_wait_list_manager) |
| 89 : connection_id_(connection_id), | 89 : connection_id_(connection_id), |
| 90 framer_(framer), | 90 framer_(framer), |
| 91 creator_(connection_id, | 91 creator_(connection_id, |
| 92 framer, | 92 framer, |
| 93 helper->GetRandomGenerator(), | |
| 94 helper->GetBufferAllocator(), | 93 helper->GetBufferAllocator(), |
| 95 &collector_), | 94 &collector_), |
| 96 time_wait_list_manager_(time_wait_list_manager) {} | 95 time_wait_list_manager_(time_wait_list_manager) {} |
| 97 | 96 |
| 98 // Generates a packet containing a CONNECTION_CLOSE frame specifying | 97 // Generates a packet containing a CONNECTION_CLOSE frame specifying |
| 99 // |error_code| and |error_details| and add the connection to time wait. | 98 // |error_code| and |error_details| and add the connection to time wait. |
| 100 void CloseConnection(QuicErrorCode error_code, | 99 void CloseConnection(QuicErrorCode error_code, |
| 101 const std::string& error_details) { | 100 const std::string& error_details) { |
| 102 QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame; | 101 QuicConnectionCloseFrame* frame = new QuicConnectionCloseFrame; |
| 103 frame->error_code = error_code; | 102 frame->error_code = error_code; |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 std::unique_ptr<QuicReceivedPacket> current_packet_; | 823 std::unique_ptr<QuicReceivedPacket> current_packet_; |
| 825 QuicPacketNumber packet_number_; | 824 QuicPacketNumber packet_number_; |
| 826 QuicVersion first_version_; | 825 QuicVersion first_version_; |
| 827 }; | 826 }; |
| 828 | 827 |
| 829 void QuicDispatcher::MaybeRejectStatelessly(QuicConnectionId connection_id, | 828 void QuicDispatcher::MaybeRejectStatelessly(QuicConnectionId connection_id, |
| 830 const QuicPacketHeader& header) { | 829 const QuicPacketHeader& header) { |
| 831 // TODO(rch): This logic should probably live completely inside the rejector. | 830 // TODO(rch): This logic should probably live completely inside the rejector. |
| 832 if (!FLAGS_quic_use_cheap_stateless_rejects || | 831 if (!FLAGS_quic_use_cheap_stateless_rejects || |
| 833 !FLAGS_enable_quic_stateless_reject_support || | 832 !FLAGS_enable_quic_stateless_reject_support || |
| 834 header.public_header.versions.front() <= QUIC_VERSION_32 || | |
| 835 !ShouldAttemptCheapStatelessRejection()) { | 833 !ShouldAttemptCheapStatelessRejection()) { |
| 836 // Not use cheap stateless reject. | 834 // Not use cheap stateless reject. |
| 837 if (!ChloExtractor::Extract(*current_packet_, GetSupportedVersions(), | 835 if (!ChloExtractor::Extract(*current_packet_, GetSupportedVersions(), |
| 838 nullptr)) { | 836 nullptr)) { |
| 839 // Buffer non-CHLO packets. | 837 // Buffer non-CHLO packets. |
| 840 ProcessUnauthenticatedHeaderFate(kFateBuffer, connection_id, | 838 ProcessUnauthenticatedHeaderFate(kFateBuffer, connection_id, |
| 841 header.packet_number); | 839 header.packet_number); |
| 842 return; | 840 return; |
| 843 } | 841 } |
| 844 ProcessUnauthenticatedHeaderFate(kFateProcess, connection_id, | 842 ProcessUnauthenticatedHeaderFate(kFateProcess, connection_id, |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 void QuicDispatcher::DeliverPacketsToSession( | 985 void QuicDispatcher::DeliverPacketsToSession( |
| 988 const std::list<BufferedPacket>& packets, | 986 const std::list<BufferedPacket>& packets, |
| 989 QuicSession* session) { | 987 QuicSession* session) { |
| 990 for (const BufferedPacket& packet : packets) { | 988 for (const BufferedPacket& packet : packets) { |
| 991 session->ProcessUdpPacket(packet.server_address, packet.client_address, | 989 session->ProcessUdpPacket(packet.server_address, packet.client_address, |
| 992 *(packet.packet)); | 990 *(packet.packet)); |
| 993 } | 991 } |
| 994 } | 992 } |
| 995 | 993 |
| 996 } // namespace net | 994 } // namespace net |
| OLD | NEW |