| 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 // 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 29 matching lines...) Expand all Loading... |
| 40 public: | 40 public: |
| 41 // Ideally we'd have a linked_hash_set: the boolean is unused. | 41 // Ideally we'd have a linked_hash_set: the boolean is unused. |
| 42 typedef linked_hash_map<QuicBlockedWriterInterface*, | 42 typedef linked_hash_map<QuicBlockedWriterInterface*, |
| 43 bool, | 43 bool, |
| 44 QuicBlockedWriterInterfacePtrHash> | 44 QuicBlockedWriterInterfacePtrHash> |
| 45 WriteBlockedList; | 45 WriteBlockedList; |
| 46 | 46 |
| 47 QuicDispatcher(const QuicConfig& config, | 47 QuicDispatcher(const QuicConfig& config, |
| 48 const QuicCryptoServerConfig* crypto_config, | 48 const QuicCryptoServerConfig* crypto_config, |
| 49 const QuicVersionVector& supported_versions, | 49 const QuicVersionVector& supported_versions, |
| 50 std::unique_ptr<QuicConnectionHelperInterface> helper); | 50 std::unique_ptr<QuicConnectionHelperInterface> helper, |
| 51 std::unique_ptr<QuicAlarmFactory> alarm_factory); |
| 51 | 52 |
| 52 ~QuicDispatcher() override; | 53 ~QuicDispatcher() override; |
| 53 | 54 |
| 54 // Takes ownership of |writer|. | 55 // Takes ownership of |writer|. |
| 55 void InitializeWithWriter(QuicPacketWriter* writer); | 56 void InitializeWithWriter(QuicPacketWriter* writer); |
| 56 | 57 |
| 57 // Process the incoming packet by creating a new session, passing it to | 58 // Process the incoming packet by creating a new session, passing it to |
| 58 // an existing session, or passing it to the time wait list. | 59 // an existing session, or passing it to the time wait list. |
| 59 void ProcessPacket(const IPEndPoint& server_address, | 60 void ProcessPacket(const IPEndPoint& server_address, |
| 60 const IPEndPoint& client_address, | 61 const IPEndPoint& client_address, |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 const QuicCryptoServerConfig* crypto_config() const { return crypto_config_; } | 186 const QuicCryptoServerConfig* crypto_config() const { return crypto_config_; } |
| 186 | 187 |
| 187 QuicCompressedCertsCache* compressed_certs_cache() { | 188 QuicCompressedCertsCache* compressed_certs_cache() { |
| 188 return &compressed_certs_cache_; | 189 return &compressed_certs_cache_; |
| 189 } | 190 } |
| 190 | 191 |
| 191 QuicFramer* framer() { return &framer_; } | 192 QuicFramer* framer() { return &framer_; } |
| 192 | 193 |
| 193 QuicConnectionHelperInterface* helper() { return helper_.get(); } | 194 QuicConnectionHelperInterface* helper() { return helper_.get(); } |
| 194 | 195 |
| 196 QuicAlarmFactory* alarm_factory() { return alarm_factory_.get(); } |
| 197 |
| 195 QuicPacketWriter* writer() { return writer_.get(); } | 198 QuicPacketWriter* writer() { return writer_.get(); } |
| 196 | 199 |
| 197 // Creates per-connection packet writers out of the QuicDispatcher's shared | 200 // Creates per-connection packet writers out of the QuicDispatcher's shared |
| 198 // QuicPacketWriter. The per-connection writers' IsWriteBlocked() state must | 201 // QuicPacketWriter. The per-connection writers' IsWriteBlocked() state must |
| 199 // always be the same as the shared writer's IsWriteBlocked(), or else the | 202 // always be the same as the shared writer's IsWriteBlocked(), or else the |
| 200 // QuicDispatcher::OnCanWrite logic will not work. (This will hopefully be | 203 // QuicDispatcher::OnCanWrite logic will not work. (This will hopefully be |
| 201 // cleaned up for bug 16950226.) | 204 // cleaned up for bug 16950226.) |
| 202 virtual QuicPacketWriter* CreatePerConnectionWriter(); | 205 virtual QuicPacketWriter* CreatePerConnectionWriter(); |
| 203 | 206 |
| 204 // Returns true if a session should be created for a connection with an | 207 // Returns true if a session should be created for a connection with an |
| (...skipping 26 matching lines...) Expand all Loading... |
| 231 | 234 |
| 232 // Entity that manages connection_ids in time wait state. | 235 // Entity that manages connection_ids in time wait state. |
| 233 std::unique_ptr<QuicTimeWaitListManager> time_wait_list_manager_; | 236 std::unique_ptr<QuicTimeWaitListManager> time_wait_list_manager_; |
| 234 | 237 |
| 235 // The list of closed but not-yet-deleted sessions. | 238 // The list of closed but not-yet-deleted sessions. |
| 236 std::vector<QuicServerSessionBase*> closed_session_list_; | 239 std::vector<QuicServerSessionBase*> closed_session_list_; |
| 237 | 240 |
| 238 // The helper used for all connections. | 241 // The helper used for all connections. |
| 239 std::unique_ptr<QuicConnectionHelperInterface> helper_; | 242 std::unique_ptr<QuicConnectionHelperInterface> helper_; |
| 240 | 243 |
| 244 // Creates alarms. |
| 245 std::unique_ptr<QuicAlarmFactory> alarm_factory_; |
| 246 |
| 241 // An alarm which deletes closed sessions. | 247 // An alarm which deletes closed sessions. |
| 242 std::unique_ptr<QuicAlarm> delete_sessions_alarm_; | 248 std::unique_ptr<QuicAlarm> delete_sessions_alarm_; |
| 243 | 249 |
| 244 // The writer to write to the socket with. | 250 // The writer to write to the socket with. |
| 245 std::unique_ptr<QuicPacketWriter> writer_; | 251 std::unique_ptr<QuicPacketWriter> writer_; |
| 246 | 252 |
| 247 // This vector contains QUIC versions which we currently support. | 253 // This vector contains QUIC versions which we currently support. |
| 248 // This should be ordered such that the highest supported version is the first | 254 // This should be ordered such that the highest supported version is the first |
| 249 // element, with subsequent elements in descending order (versions can be | 255 // element, with subsequent elements in descending order (versions can be |
| 250 // skipped as necessary). | 256 // skipped as necessary). |
| (...skipping 10 matching lines...) Expand all Loading... |
| 261 // The last error set by SetLastError(), which is called by | 267 // The last error set by SetLastError(), which is called by |
| 262 // framer_visitor_->OnError(). | 268 // framer_visitor_->OnError(). |
| 263 QuicErrorCode last_error_; | 269 QuicErrorCode last_error_; |
| 264 | 270 |
| 265 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); | 271 DISALLOW_COPY_AND_ASSIGN(QuicDispatcher); |
| 266 }; | 272 }; |
| 267 | 273 |
| 268 } // namespace net | 274 } // namespace net |
| 269 | 275 |
| 270 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ | 276 #endif // NET_TOOLS_QUIC_QUIC_DISPATCHER_H_ |
| OLD | NEW |