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

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

Issue 182523002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed rch's comments in Patch set 1 of CL 181463007 Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « net/tools/quic/quic_client.cc ('k') | 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
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 virtual void OnCanWrite(); 79 virtual void OnCanWrite();
80 80
81 // Returns true if there's anything in the blocked writer list. 81 // Returns true if there's anything in the blocked writer list.
82 virtual bool HasPendingWrites() const; 82 virtual bool HasPendingWrites() const;
83 83
84 // Sends ConnectionClose frames to all connected clients. 84 // Sends ConnectionClose frames to all connected clients.
85 void Shutdown(); 85 void Shutdown();
86 86
87 // QuicServerSessionVisitor interface implementation: 87 // QuicServerSessionVisitor interface implementation:
88 // Ensure that the closed connection is cleaned up asynchronously. 88 // Ensure that the closed connection is cleaned up asynchronously.
89 virtual void OnConnectionClosed(QuicGuid guid, QuicErrorCode error) OVERRIDE; 89 virtual void OnConnectionClosed(QuicConnectionId connection_id,
90 QuicErrorCode error) OVERRIDE;
90 91
91 // Queues the blocked writer for later resumption. 92 // Queues the blocked writer for later resumption.
92 virtual void OnWriteBlocked(QuicBlockedWriterInterface* writer) OVERRIDE; 93 virtual void OnWriteBlocked(QuicBlockedWriterInterface* writer) OVERRIDE;
93 94
94 typedef base::hash_map<QuicGuid, QuicSession*> SessionMap; 95 typedef base::hash_map<QuicConnectionId, QuicSession*> SessionMap;
95 96
96 // Deletes all sessions on the closed session list and clears the list. 97 // Deletes all sessions on the closed session list and clears the list.
97 void DeleteSessions(); 98 void DeleteSessions();
98 99
99 const SessionMap& session_map() const { return session_map_; } 100 const SessionMap& session_map() const { return session_map_; }
100 101
101 WriteBlockedList* write_blocked_list() { return &write_blocked_list_; } 102 WriteBlockedList* write_blocked_list() { return &write_blocked_list_; }
102 103
103 protected: 104 protected:
104 // Instantiates a new low-level packet writer. Caller takes ownership of the 105 // Instantiates a new low-level packet writer. Caller takes ownership of the
105 // returned object. 106 // returned object.
106 QuicPacketWriter* CreateWriter(int fd); 107 QuicPacketWriter* CreateWriter(int fd);
107 108
108 // Instantiates a new top-level writer wrapper. Takes ownership of |writer|. 109 // Instantiates a new top-level writer wrapper. Takes ownership of |writer|.
109 // Caller takes ownership of the returned object. 110 // Caller takes ownership of the returned object.
110 virtual QuicPacketWriterWrapper* CreateWriterWrapper( 111 virtual QuicPacketWriterWrapper* CreateWriterWrapper(
111 QuicPacketWriter* writer); 112 QuicPacketWriter* writer);
112 113
113 virtual QuicSession* CreateQuicSession(QuicGuid guid, 114 virtual QuicSession* CreateQuicSession(QuicConnectionId connection_id,
114 const IPEndPoint& server_address, 115 const IPEndPoint& server_address,
115 const IPEndPoint& client_address); 116 const IPEndPoint& client_address);
116 117
117 QuicConnection* CreateQuicConnection(QuicGuid guid, 118 QuicConnection* CreateQuicConnection(QuicConnectionId connection_id,
118 const IPEndPoint& server_address, 119 const IPEndPoint& server_address,
119 const IPEndPoint& client_address); 120 const IPEndPoint& client_address);
120 121
121 // Replaces the packet writer with |writer|. Takes ownership of |writer|. 122 // Replaces the packet writer with |writer|. Takes ownership of |writer|.
122 void set_writer(QuicPacketWriter* writer); 123 void set_writer(QuicPacketWriter* writer);
123 124
124 QuicTimeWaitListManager* time_wait_list_manager() { 125 QuicTimeWaitListManager* time_wait_list_manager() {
125 return time_wait_list_manager_.get(); 126 return time_wait_list_manager_.get();
126 } 127 }
127 128
(...skipping 25 matching lines...) Expand all
153 154
154 private: 155 private:
155 class QuicFramerVisitor; 156 class QuicFramerVisitor;
156 friend class net::tools::test::QuicDispatcherPeer; 157 friend class net::tools::test::QuicDispatcherPeer;
157 158
158 // Called by |framer_visitor_| when the private header has been parsed 159 // Called by |framer_visitor_| when the private header has been parsed
159 // of a data packet that is destined for the time wait manager. 160 // of a data packet that is destined for the time wait manager.
160 void OnUnauthenticatedHeader(const QuicPacketHeader& header); 161 void OnUnauthenticatedHeader(const QuicPacketHeader& header);
161 162
162 // Removes the session from the session map and write blocked list, and 163 // Removes the session from the session map and write blocked list, and
163 // adds the GUID to the time-wait list. 164 // adds the ConnectionId to the time-wait list.
164 void CleanUpSession(SessionMap::iterator it); 165 void CleanUpSession(SessionMap::iterator it);
165 166
166 bool HandlePacketForTimeWait(const QuicPacketPublicHeader& header); 167 bool HandlePacketForTimeWait(const QuicPacketPublicHeader& header);
167 168
168 const QuicConfig& config_; 169 const QuicConfig& config_;
169 170
170 const QuicCryptoServerConfig& crypto_config_; 171 const QuicCryptoServerConfig& crypto_config_;
171 172
172 // The list of connections waiting to write. 173 // The list of connections waiting to write.
173 WriteBlockedList write_blocked_list_; 174 WriteBlockedList write_blocked_list_;
174 175
175 SessionMap session_map_; 176 SessionMap session_map_;
176 177
177 // Entity that manages guids in time wait state. 178 // Entity that manages connection_ids in time wait state.
178 scoped_ptr<QuicTimeWaitListManager> time_wait_list_manager_; 179 scoped_ptr<QuicTimeWaitListManager> time_wait_list_manager_;
179 180
180 // An alarm which deletes closed sessions. 181 // An alarm which deletes closed sessions.
181 scoped_ptr<DeleteSessionsAlarm> delete_sessions_alarm_; 182 scoped_ptr<DeleteSessionsAlarm> delete_sessions_alarm_;
182 183
183 // The list of closed but not-yet-deleted sessions. 184 // The list of closed but not-yet-deleted sessions.
184 std::list<QuicSession*> closed_session_list_; 185 std::list<QuicSession*> closed_session_list_;
185 186
186 EpollServer* epoll_server_; // Owned by the server. 187 EpollServer* epoll_server_; // Owned by the server.
187 188
(...skipping 19 matching lines...) Expand all
207 QuicFramer framer_; 208 QuicFramer framer_;
208 scoped_ptr<QuicFramerVisitor> framer_visitor_; 209 scoped_ptr<QuicFramerVisitor> framer_visitor_;
209 210
210 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); 211 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher);
211 }; 212 };
212 213
213 } // namespace tools 214 } // namespace tools
214 } // namespace net 215 } // namespace net
215 216
216 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ 217 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client.cc ('k') | net/tools/quic/quic_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698