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

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

Issue 2460163002: Refactor QuicServerSessionBase::Visitor (Closed)
Patch Set: Updated patchset dependency Created 4 years, 1 month 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 | « net/quic/test_tools/quic_test_utils.cc ('k') | net/tools/quic/quic_simple_dispatcher.h » ('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
(...skipping 19 matching lines...) Expand all
30 30
31 namespace net { 31 namespace net {
32 32
33 class QuicConfig; 33 class QuicConfig;
34 class QuicCryptoServerConfig; 34 class QuicCryptoServerConfig;
35 35
36 namespace test { 36 namespace test {
37 class QuicDispatcherPeer; 37 class QuicDispatcherPeer;
38 } // namespace test 38 } // namespace test
39 39
40 class QuicDispatcher : public QuicServerSessionBase::Visitor, 40 class QuicDispatcher : public QuicTimeWaitListManager::Visitor,
41 public ProcessPacketInterface, 41 public ProcessPacketInterface,
42 public QuicBlockedWriterInterface, 42 public QuicBlockedWriterInterface,
43 public QuicFramerVisitorInterface, 43 public QuicFramerVisitorInterface,
44 public QuicBufferedPacketStore::VisitorInterface { 44 public QuicBufferedPacketStore::VisitorInterface {
45 public: 45 public:
46 // Ideally we'd have a linked_hash_set: the boolean is unused. 46 // Ideally we'd have a linked_hash_set: the boolean is unused.
47 typedef linked_hash_map<QuicBlockedWriterInterface*, 47 typedef linked_hash_map<QuicBlockedWriterInterface*,
48 bool, 48 bool,
49 QuicBlockedWriterInterfacePtrHash> 49 QuicBlockedWriterInterfacePtrHash>
50 WriteBlockedList; 50 WriteBlockedList;
(...skipping 18 matching lines...) Expand all
69 69
70 // Called when the socket becomes writable to allow queued writes to happen. 70 // Called when the socket becomes writable to allow queued writes to happen.
71 void OnCanWrite() override; 71 void OnCanWrite() override;
72 72
73 // Returns true if there's anything in the blocked writer list. 73 // Returns true if there's anything in the blocked writer list.
74 virtual bool HasPendingWrites() const; 74 virtual bool HasPendingWrites() const;
75 75
76 // Sends ConnectionClose frames to all connected clients. 76 // Sends ConnectionClose frames to all connected clients.
77 void Shutdown(); 77 void Shutdown();
78 78
79 // QuicServerSessionBase::Visitor interface implementation: 79 // QuicSession::Visitor interface implementation (via inheritance of
80 // QuicTimeWaitListManager::Visitor):
80 // Ensure that the closed connection is cleaned up asynchronously. 81 // Ensure that the closed connection is cleaned up asynchronously.
81 void OnConnectionClosed(QuicConnectionId connection_id, 82 void OnConnectionClosed(QuicConnectionId connection_id,
82 QuicErrorCode error, 83 QuicErrorCode error,
83 const std::string& error_details) override; 84 const std::string& error_details) override;
84 85
86 // QuicSession::Visitor interface implementation (via inheritance of
87 // QuicTimeWaitListManager::Visitor):
85 // Queues the blocked writer for later resumption. 88 // Queues the blocked writer for later resumption.
86 void OnWriteBlocked(QuicBlockedWriterInterface* blocked_writer) override; 89 void OnWriteBlocked(QuicBlockedWriterInterface* blocked_writer) override;
87 90
88 // Called whenever the time wait list manager adds a new connection to the 91 // QuicTimeWaitListManager::Visitor interface implementation
89 // time-wait list. 92 // Called whenever the time wait std::list manager adds a new connection to
93 // the
94 // time-wait std::list.
90 void OnConnectionAddedToTimeWaitList(QuicConnectionId connection_id) override; 95 void OnConnectionAddedToTimeWaitList(QuicConnectionId connection_id) override;
91 96
92 void OnPacketBeingDispatchedToSession(QuicSession* session) override {}
93
94 using SessionMap = 97 using SessionMap =
95 std::unordered_map<QuicConnectionId, std::unique_ptr<QuicSession>>; 98 std::unordered_map<QuicConnectionId, std::unique_ptr<QuicSession>>;
96 99
97 const SessionMap& session_map() const { return session_map_; } 100 const SessionMap& session_map() const { return session_map_; }
98 101
99 // Deletes all sessions on the closed session list and clears the list. 102 // Deletes all sessions on the closed session list and clears the list.
100 virtual void DeleteSessions(); 103 virtual void DeleteSessions();
101 104
102 // The largest packet number we expect to receive with a connection 105 // The largest packet number we expect to receive with a connection
103 // ID for a connection that is not established yet. The current design will 106 // ID for a connection that is not established yet. The current design will
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 // A backward counter of how many new sessions can be create within current 383 // A backward counter of how many new sessions can be create within current
381 // event loop. When reaches 0, it means can't create sessions for now. 384 // event loop. When reaches 0, it means can't create sessions for now.
382 int16_t new_sessions_allowed_per_event_loop_; 385 int16_t new_sessions_allowed_per_event_loop_;
383 386
384 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); 387 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher);
385 }; 388 };
386 389
387 } // namespace net 390 } // namespace net
388 391
389 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ 392 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.cc ('k') | net/tools/quic/quic_simple_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698