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

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

Issue 1899753003: Split out QuicAlarm creation from QuicConnectionHelper to new QuicAlarmFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@119871679
Patch Set: Created 4 years, 8 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
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 QuicBlockedWriterInterfacePtrHash> 44 QuicBlockedWriterInterfacePtrHash>
45 WriteBlockedList; 45 WriteBlockedList;
46 46
47 // Due to the way delete_sessions_closure_ is registered, the Dispatcher must 47 // Due to the way delete_sessions_closure_ is registered, the Dispatcher must
48 // live until server Shutdown. |supported_versions| specifies the std::list 48 // live until server Shutdown. |supported_versions| specifies the std::list
49 // of supported QUIC versions. Takes ownership of |packet_writer_factory|, 49 // of supported QUIC versions. Takes ownership of |packet_writer_factory|,
50 // which is used to create per-connection writers. 50 // which is used to create per-connection writers.
51 QuicDispatcher(const QuicConfig& config, 51 QuicDispatcher(const QuicConfig& config,
52 const QuicCryptoServerConfig* crypto_config, 52 const QuicCryptoServerConfig* crypto_config,
53 const QuicVersionVector& supported_versions, 53 const QuicVersionVector& supported_versions,
54 QuicConnectionHelperInterface* helper); 54 QuicConnectionHelperInterface* helper,
55 QuicAlarmFactory* alarm_factory);
55 56
56 ~QuicDispatcher() override; 57 ~QuicDispatcher() override;
57 58
58 // Takes ownership of |writer|. 59 // Takes ownership of |writer|.
59 void InitializeWithWriter(QuicPacketWriter* writer); 60 void InitializeWithWriter(QuicPacketWriter* writer);
60 61
61 // Process the incoming packet by creating a new session, passing it to 62 // Process the incoming packet by creating a new session, passing it to
62 // an existing session, or passing it to the time wait list. 63 // an existing session, or passing it to the time wait list.
63 void ProcessPacket(const IPEndPoint& server_address, 64 void ProcessPacket(const IPEndPoint& server_address,
64 const IPEndPoint& client_address, 65 const IPEndPoint& client_address,
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 const QuicCryptoServerConfig* crypto_config() const { return crypto_config_; } 190 const QuicCryptoServerConfig* crypto_config() const { return crypto_config_; }
190 191
191 QuicCompressedCertsCache* compressed_certs_cache() { 192 QuicCompressedCertsCache* compressed_certs_cache() {
192 return &compressed_certs_cache_; 193 return &compressed_certs_cache_;
193 } 194 }
194 195
195 QuicFramer* framer() { return &framer_; } 196 QuicFramer* framer() { return &framer_; }
196 197
197 QuicConnectionHelperInterface* helper() { return helper_.get(); } 198 QuicConnectionHelperInterface* helper() { return helper_.get(); }
198 199
200 QuicAlarmFactory* alarm_factory() { return alarm_factory_.get(); }
201
199 QuicPacketWriter* writer() { return writer_.get(); } 202 QuicPacketWriter* writer() { return writer_.get(); }
200 203
201 // Creates per-connection packet writers out of the QuicDispatcher's shared 204 // Creates per-connection packet writers out of the QuicDispatcher's shared
202 // QuicPacketWriter. The per-connection writers' IsWriteBlocked() state must 205 // QuicPacketWriter. The per-connection writers' IsWriteBlocked() state must
203 // always be the same as the shared writer's IsWriteBlocked(), or else the 206 // always be the same as the shared writer's IsWriteBlocked(), or else the
204 // QuicDispatcher::OnCanWrite logic will not work. (This will hopefully be 207 // QuicDispatcher::OnCanWrite logic will not work. (This will hopefully be
205 // cleaned up for bug 16950226.) 208 // cleaned up for bug 16950226.)
206 virtual QuicPacketWriter* CreatePerConnectionWriter(); 209 virtual QuicPacketWriter* CreatePerConnectionWriter();
207 210
208 // Returns true if a session should be created for a connection with an 211 // Returns true if a session should be created for a connection with an
(...skipping 26 matching lines...) Expand all
235 238
236 // Entity that manages connection_ids in time wait state. 239 // Entity that manages connection_ids in time wait state.
237 std::unique_ptr<QuicTimeWaitListManager> time_wait_list_manager_; 240 std::unique_ptr<QuicTimeWaitListManager> time_wait_list_manager_;
238 241
239 // The list of closed but not-yet-deleted sessions. 242 // The list of closed but not-yet-deleted sessions.
240 std::vector<QuicServerSessionBase*> closed_session_list_; 243 std::vector<QuicServerSessionBase*> closed_session_list_;
241 244
242 // The helper used for all connections. 245 // The helper used for all connections.
243 std::unique_ptr<QuicConnectionHelperInterface> helper_; 246 std::unique_ptr<QuicConnectionHelperInterface> helper_;
244 247
248 // Creates alarms.
249 std::unique_ptr<QuicAlarmFactory> alarm_factory_;
250
245 // An alarm which deletes closed sessions. 251 // An alarm which deletes closed sessions.
246 std::unique_ptr<QuicAlarm> delete_sessions_alarm_; 252 std::unique_ptr<QuicAlarm> delete_sessions_alarm_;
247 253
248 // The writer to write to the socket with. 254 // The writer to write to the socket with.
249 std::unique_ptr<QuicPacketWriter> writer_; 255 std::unique_ptr<QuicPacketWriter> writer_;
250 256
251 // This vector contains QUIC versions which we currently support. 257 // This vector contains QUIC versions which we currently support.
252 // This should be ordered such that the highest supported version is the first 258 // This should be ordered such that the highest supported version is the first
253 // element, with subsequent elements in descending order (versions can be 259 // element, with subsequent elements in descending order (versions can be
254 // skipped as necessary). 260 // skipped as necessary).
(...skipping 10 matching lines...) Expand all
265 // The last error set by SetLastError(), which is called by 271 // The last error set by SetLastError(), which is called by
266 // framer_visitor_->OnError(). 272 // framer_visitor_->OnError().
267 QuicErrorCode last_error_; 273 QuicErrorCode last_error_;
268 274
269 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); 275 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher);
270 }; 276 };
271 277
272 } // namespace net 278 } // namespace net
273 279
274 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ 280 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698