Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: net/tools/quic/quic_dispatcher.h

Issue 2319933003: Move StatelessRejector to a heap-allocated model (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/tools/quic/quic_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // A server side dispatcher which dispatches a given client's data to their 5 // A server side dispatcher which dispatches a given client's data to their
6 // stream. 6 // stream.
7 7
8 #ifndef NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ 8 #ifndef NET_TOOLS_QUIC_QUIC_DISPATCHER_H_
9 #define NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ 9 #define NET_TOOLS_QUIC_QUIC_DISPATCHER_H_
10 10
11 #include <memory> 11 #include <memory>
12 #include <unordered_map> 12 #include <unordered_map>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "net/base/ip_endpoint.h" 16 #include "net/base/ip_endpoint.h"
17 #include "net/base/linked_hash_map.h" 17 #include "net/base/linked_hash_map.h"
18 #include "net/quic/core/crypto/quic_compressed_certs_cache.h" 18 #include "net/quic/core/crypto/quic_compressed_certs_cache.h"
19 #include "net/quic/core/crypto/quic_random.h" 19 #include "net/quic/core/crypto/quic_random.h"
20 #include "net/quic/core/quic_blocked_writer_interface.h" 20 #include "net/quic/core/quic_blocked_writer_interface.h"
21 #include "net/quic/core/quic_buffered_packet_store.h" 21 #include "net/quic/core/quic_buffered_packet_store.h"
22 #include "net/quic/core/quic_connection.h" 22 #include "net/quic/core/quic_connection.h"
23 #include "net/quic/core/quic_protocol.h" 23 #include "net/quic/core/quic_protocol.h"
24 #include "net/quic/core/quic_server_session_base.h" 24 #include "net/quic/core/quic_server_session_base.h"
25
26 #include "net/tools/quic/stateless_rejector.h"
25 #include "net/tools/quic/quic_process_packet_interface.h" 27 #include "net/tools/quic/quic_process_packet_interface.h"
26 #include "net/tools/quic/quic_time_wait_list_manager.h" 28 #include "net/tools/quic/quic_time_wait_list_manager.h"
27 29
28 namespace net { 30 namespace net {
29 31
30 class QuicConfig; 32 class QuicConfig;
31 class QuicCryptoServerConfig; 33 class QuicCryptoServerConfig;
32 class QuicServerSessionBase; 34 class QuicServerSessionBase;
33 35
34 namespace test { 36 namespace test {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 261
260 bool HasBufferedPackets(QuicConnectionId connection_id); 262 bool HasBufferedPackets(QuicConnectionId connection_id);
261 263
262 // Called when BufferEarlyPacket() fail to buffer the packet. 264 // Called when BufferEarlyPacket() fail to buffer the packet.
263 virtual void OnBufferPacketFailure( 265 virtual void OnBufferPacketFailure(
264 QuicBufferedPacketStore::EnqueuePacketResult result, 266 QuicBufferedPacketStore::EnqueuePacketResult result,
265 QuicConnectionId connection_id); 267 QuicConnectionId connection_id);
266 268
267 private: 269 private:
268 friend class net::test::QuicDispatcherPeer; 270 friend class net::test::QuicDispatcherPeer;
271 friend class StatelessRejectorProcessDoneCallback;
269 272
270 // Removes the session from the session map and write blocked list, and adds 273 // Removes the session from the session map and write blocked list, and adds
271 // the ConnectionId to the time-wait list. If |session_closed_statelessly| is 274 // the ConnectionId to the time-wait list. If |session_closed_statelessly| is
272 // true, any future packets for the ConnectionId will be black-holed. 275 // true, any future packets for the ConnectionId will be black-holed.
273 void CleanUpSession(SessionMap::iterator it, bool session_closed_statelessly); 276 void CleanUpSession(SessionMap::iterator it, bool session_closed_statelessly);
274 277
275 bool HandlePacketForTimeWait(const QuicPacketPublicHeader& header); 278 bool HandlePacketForTimeWait(const QuicPacketPublicHeader& header);
276 279
277 // Attempts to reject the connection statelessly, if stateless rejects are 280 // Attempts to reject the connection statelessly, if stateless rejects are
278 // possible and if the current packet contains a CHLO message. 281 // possible and if the current packet contains a CHLO message. Determines a
279 // Returns a fate which describes what subsequent processing should be 282 // fate which describes what subsequent processing should be performed on the
280 // performed on the packets, like ValidityChecks. 283 // packets, like ValidityChecks, and invokes ProcessUnauthenticatedHeaderFate.
281 QuicPacketFate MaybeRejectStatelessly(QuicConnectionId connection_id, 284 void MaybeRejectStatelessly(QuicConnectionId connection_id,
282 const QuicPacketHeader& header); 285 const QuicPacketHeader& header);
283 286
284 // Deliver |packets| to |session| for further processing. 287 // Deliver |packets| to |session| for further processing.
285 void DeliverPacketsToSession( 288 void DeliverPacketsToSession(
286 const std::list<QuicBufferedPacketStore::BufferedPacket>& packets, 289 const std::list<QuicBufferedPacketStore::BufferedPacket>& packets,
287 QuicServerSessionBase* session); 290 QuicServerSessionBase* session);
288 291
289 // Perform the appropriate actions on the current packet based on |fate| - 292 // Perform the appropriate actions on the current packet based on |fate| -
290 // either process, buffer, or drop it. 293 // either process, buffer, or drop it.
291 void ProcessUnauthenticatedHeaderFate(QuicPacketFate fate, 294 void ProcessUnauthenticatedHeaderFate(QuicPacketFate fate,
292 QuicConnectionId connection_id, 295 QuicConnectionId connection_id,
293 QuicPacketNumber packet_number); 296 QuicPacketNumber packet_number);
294 297
298 // Invoked when StatelessRejector::Process completes.
299 void OnStatelessRejectorProcessDone(
300 std::unique_ptr<StatelessRejector> rejector,
301 QuicPacketNumber packet_number,
302 QuicVersion first_version);
303
295 void set_new_sessions_allowed_per_event_loop( 304 void set_new_sessions_allowed_per_event_loop(
296 int16_t new_sessions_allowed_per_event_loop) { 305 int16_t new_sessions_allowed_per_event_loop) {
297 new_sessions_allowed_per_event_loop_ = new_sessions_allowed_per_event_loop; 306 new_sessions_allowed_per_event_loop_ = new_sessions_allowed_per_event_loop;
298 } 307 }
299 308
300 const QuicConfig& config_; 309 const QuicConfig& config_;
301 310
302 const QuicCryptoServerConfig* crypto_config_; 311 const QuicCryptoServerConfig* crypto_config_;
303 312
304 // The cache for most recently compressed certs. 313 // The cache for most recently compressed certs.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // A backward counter of how many new sessions can be create within current 361 // A backward counter of how many new sessions can be create within current
353 // event loop. When reaches 0, it means can't create sessions for now. 362 // event loop. When reaches 0, it means can't create sessions for now.
354 int16_t new_sessions_allowed_per_event_loop_; 363 int16_t new_sessions_allowed_per_event_loop_;
355 364
356 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); 365 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher);
357 }; 366 };
358 367
359 } // namespace net 368 } // namespace net
360 369
361 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ 370 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_
OLDNEW
« no previous file with comments | « no previous file | net/tools/quic/quic_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698