| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // immediately. | 266 // immediately. |
| 267 QuicConnectionId connection_id = header.connection_id; | 267 QuicConnectionId connection_id = header.connection_id; |
| 268 SessionMap::iterator it = session_map_.find(connection_id); | 268 SessionMap::iterator it = session_map_.find(connection_id); |
| 269 if (it != session_map_.end()) { | 269 if (it != session_map_.end()) { |
| 270 DCHECK(!buffered_packets_.HasBufferedPackets(connection_id)); | 270 DCHECK(!buffered_packets_.HasBufferedPackets(connection_id)); |
| 271 it->second->ProcessUdpPacket(current_server_address_, | 271 it->second->ProcessUdpPacket(current_server_address_, |
| 272 current_client_address_, *current_packet_); | 272 current_client_address_, *current_packet_); |
| 273 return false; | 273 return false; |
| 274 } | 274 } |
| 275 | 275 |
| 276 if (FLAGS_quic_buffer_packets_after_chlo && |
| 277 buffered_packets_.HasChloForConnection(connection_id)) { |
| 278 BufferEarlyPacket(connection_id); |
| 279 return false; |
| 280 } |
| 281 |
| 276 if (!OnUnauthenticatedUnknownPublicHeader(header)) { | 282 if (!OnUnauthenticatedUnknownPublicHeader(header)) { |
| 277 return false; | 283 return false; |
| 278 } | 284 } |
| 279 | 285 |
| 280 // If the packet is a public reset for a connection ID that is not active, | 286 // If the packet is a public reset for a connection ID that is not active, |
| 281 // there is nothing we must do or can do. | 287 // there is nothing we must do or can do. |
| 282 if (header.reset_flag) { | 288 if (header.reset_flag) { |
| 283 return false; | 289 return false; |
| 284 } | 290 } |
| 285 | 291 |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 << "Try to limit connection creation per epoll event while not " | 691 << "Try to limit connection creation per epoll event while not " |
| 686 "supporting packet buffer. " | 692 "supporting packet buffer. " |
| 687 "--quic_limit_num_new_sessions_per_epoll_loop = true " | 693 "--quic_limit_num_new_sessions_per_epoll_loop = true " |
| 688 "--quic_buffer_packet_till_chlo = false"; | 694 "--quic_buffer_packet_till_chlo = false"; |
| 689 | 695 |
| 690 if (FLAGS_quic_limit_num_new_sessions_per_epoll_loop && | 696 if (FLAGS_quic_limit_num_new_sessions_per_epoll_loop && |
| 691 FLAGS_quic_buffer_packet_till_chlo && | 697 FLAGS_quic_buffer_packet_till_chlo && |
| 692 new_sessions_allowed_per_event_loop_ <= 0) { | 698 new_sessions_allowed_per_event_loop_ <= 0) { |
| 693 // Can't create new session any more. Wait till next event loop. | 699 // Can't create new session any more. Wait till next event loop. |
| 694 if (!buffered_packets_.HasChloForConnection(current_connection_id_)) { | 700 if (!buffered_packets_.HasChloForConnection(current_connection_id_)) { |
| 695 // Only buffer one CHLO per connection. | 701 // Only buffer one CHLO per connection. Remove this condition check when |
| 702 // --gfe2_reloadable_flag_quic_buffer_packets_after_chlo |
| 703 // is deprecated because after that retransmitted CHLO should be buffered |
| 704 // earlier in OnUnauthenticatedPublicHeader(). |
| 696 bool is_new_connection = | 705 bool is_new_connection = |
| 697 !buffered_packets_.HasBufferedPackets(current_connection_id_); | 706 !buffered_packets_.HasBufferedPackets(current_connection_id_); |
| 698 EnqueuePacketResult rs = buffered_packets_.EnqueuePacket( | 707 EnqueuePacketResult rs = buffered_packets_.EnqueuePacket( |
| 699 current_connection_id_, *current_packet_, current_server_address_, | 708 current_connection_id_, *current_packet_, current_server_address_, |
| 700 current_client_address_, /*is_chlo=*/true); | 709 current_client_address_, /*is_chlo=*/true); |
| 701 if (rs != EnqueuePacketResult::SUCCESS) { | 710 if (rs != EnqueuePacketResult::SUCCESS) { |
| 702 OnBufferPacketFailure(rs, current_connection_id_); | 711 OnBufferPacketFailure(rs, current_connection_id_); |
| 703 } else if (is_new_connection) { | 712 } else if (is_new_connection) { |
| 704 OnNewConnectionAdded(current_connection_id_); | 713 OnNewConnectionAdded(current_connection_id_); |
| 705 } | 714 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 void QuicDispatcher::DeliverPacketsToSession( | 915 void QuicDispatcher::DeliverPacketsToSession( |
| 907 const std::list<BufferedPacket>& packets, | 916 const std::list<BufferedPacket>& packets, |
| 908 QuicServerSessionBase* session) { | 917 QuicServerSessionBase* session) { |
| 909 for (const BufferedPacket& packet : packets) { | 918 for (const BufferedPacket& packet : packets) { |
| 910 session->ProcessUdpPacket(packet.server_address, packet.client_address, | 919 session->ProcessUdpPacket(packet.server_address, packet.client_address, |
| 911 *(packet.packet)); | 920 *(packet.packet)); |
| 912 } | 921 } |
| 913 } | 922 } |
| 914 | 923 |
| 915 } // namespace net | 924 } // namespace net |
| OLD | NEW |