| 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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "net/quic/core/crypto/quic_random.h" | 10 #include "net/quic/core/crypto/quic_random.h" |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 *current_packet_); | 772 *current_packet_); |
| 773 // Deliver queued-up packets in the same order as they arrived. | 773 // Deliver queued-up packets in the same order as they arrived. |
| 774 // Do this even when flag is off because there might be still some packets | 774 // Do this even when flag is off because there might be still some packets |
| 775 // buffered in the store before flag is turned off. | 775 // buffered in the store before flag is turned off. |
| 776 DeliverPacketsToSession(packets, session); | 776 DeliverPacketsToSession(packets, session); |
| 777 if (FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop) { | 777 if (FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop) { |
| 778 --new_sessions_allowed_per_event_loop_; | 778 --new_sessions_allowed_per_event_loop_; |
| 779 } | 779 } |
| 780 } | 780 } |
| 781 | 781 |
| 782 const QuicSocketAddress QuicDispatcher::GetClientAddress() const { |
| 783 return current_client_address_; |
| 784 } |
| 785 |
| 782 bool QuicDispatcher::HandlePacketForTimeWait( | 786 bool QuicDispatcher::HandlePacketForTimeWait( |
| 783 const QuicPacketPublicHeader& header) { | 787 const QuicPacketPublicHeader& header) { |
| 784 if (header.reset_flag) { | 788 if (header.reset_flag) { |
| 785 // Public reset packets do not have packet numbers, so ignore the packet. | 789 // Public reset packets do not have packet numbers, so ignore the packet. |
| 786 return false; | 790 return false; |
| 787 } | 791 } |
| 788 | 792 |
| 789 // Switch the framer to the correct version, so that the packet number can | 793 // Switch the framer to the correct version, so that the packet number can |
| 790 // be parsed correctly. | 794 // be parsed correctly. |
| 791 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 795 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 ProcessUnauthenticatedHeaderFate(kFateBuffer, connection_id); | 854 ProcessUnauthenticatedHeaderFate(kFateBuffer, connection_id); |
| 851 return; | 855 return; |
| 852 } | 856 } |
| 853 ProcessUnauthenticatedHeaderFate(kFateProcess, connection_id); | 857 ProcessUnauthenticatedHeaderFate(kFateProcess, connection_id); |
| 854 return; | 858 return; |
| 855 } | 859 } |
| 856 | 860 |
| 857 std::unique_ptr<StatelessRejector> rejector(new StatelessRejector( | 861 std::unique_ptr<StatelessRejector> rejector(new StatelessRejector( |
| 858 version, GetSupportedVersions(), crypto_config_, &compressed_certs_cache_, | 862 version, GetSupportedVersions(), crypto_config_, &compressed_certs_cache_, |
| 859 helper()->GetClock(), helper()->GetRandomGenerator(), | 863 helper()->GetClock(), helper()->GetRandomGenerator(), |
| 860 current_packet_->length(), current_client_address_, | 864 current_packet_->length(), GetClientAddress(), current_server_address_)); |
| 861 current_server_address_)); | |
| 862 ChloValidator validator(session_helper_.get(), current_server_address_, | 865 ChloValidator validator(session_helper_.get(), current_server_address_, |
| 863 rejector.get()); | 866 rejector.get()); |
| 864 if (!ChloExtractor::Extract(*current_packet_, GetSupportedVersions(), | 867 if (!ChloExtractor::Extract(*current_packet_, GetSupportedVersions(), |
| 865 &validator)) { | 868 &validator)) { |
| 866 ProcessUnauthenticatedHeaderFate(kFateBuffer, connection_id); | 869 ProcessUnauthenticatedHeaderFate(kFateBuffer, connection_id); |
| 867 return; | 870 return; |
| 868 } | 871 } |
| 869 | 872 |
| 870 if (!validator.can_accept()) { | 873 if (!validator.can_accept()) { |
| 871 // This CHLO is prohibited by policy. | 874 // This CHLO is prohibited by policy. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 void QuicDispatcher::DeliverPacketsToSession( | 987 void QuicDispatcher::DeliverPacketsToSession( |
| 985 const std::list<BufferedPacket>& packets, | 988 const std::list<BufferedPacket>& packets, |
| 986 QuicSession* session) { | 989 QuicSession* session) { |
| 987 for (const BufferedPacket& packet : packets) { | 990 for (const BufferedPacket& packet : packets) { |
| 988 session->ProcessUdpPacket(packet.server_address, packet.client_address, | 991 session->ProcessUdpPacket(packet.server_address, packet.client_address, |
| 989 *(packet.packet)); | 992 *(packet.packet)); |
| 990 } | 993 } |
| 991 } | 994 } |
| 992 | 995 |
| 993 } // namespace net | 996 } // namespace net |
| OLD | NEW |