| 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 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_ | 5 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_ |
| 6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_ | 6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 // When a connection is idle for 30 seconds it will be closed. | 67 // When a connection is idle for 30 seconds it will be closed. |
| 68 const int kIdleConnectionTimeoutSeconds = 30; | 68 const int kIdleConnectionTimeoutSeconds = 30; |
| 69 | 69 |
| 70 // Indicates cause when connection migration is triggered. | 70 // Indicates cause when connection migration is triggered. |
| 71 enum MigrationCause { | 71 enum MigrationCause { |
| 72 EARLY_MIGRATION, // Migration due to path degradation. | 72 EARLY_MIGRATION, // Migration due to path degradation. |
| 73 WRITE_ERROR // Migration due to socket write error. | 73 WRITE_ERROR // Migration due to socket write error. |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 // Result of a session migration attempt. |
| 77 enum class MigrationResult { |
| 78 SUCCESS, // Migration succeeded. |
| 79 NO_NEW_NETWORK, // Migration failed since no new network was found. |
| 80 FAILURE // Migration failed for other reasons. |
| 81 }; |
| 82 |
| 76 // Encapsulates a pending request for a QuicHttpStream. | 83 // Encapsulates a pending request for a QuicHttpStream. |
| 77 // If the request is still pending when it is destroyed, it will | 84 // If the request is still pending when it is destroyed, it will |
| 78 // cancel the request with the factory. | 85 // cancel the request with the factory. |
| 79 class NET_EXPORT_PRIVATE QuicStreamRequest { | 86 class NET_EXPORT_PRIVATE QuicStreamRequest { |
| 80 public: | 87 public: |
| 81 explicit QuicStreamRequest(QuicStreamFactory* factory); | 88 explicit QuicStreamRequest(QuicStreamFactory* factory); |
| 82 ~QuicStreamRequest(); | 89 ~QuicStreamRequest(); |
| 83 | 90 |
| 84 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is | 91 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is |
| 85 // passed to CertVerifier::Verify. | 92 // passed to CertVerifier::Verify. |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 // If |new_network| is NetworkChangeNotifier::kInvalidNetworkHandle, | 303 // If |new_network| is NetworkChangeNotifier::kInvalidNetworkHandle, |
| 297 // there is no new network to migrate sessions onto, and all sessions are | 304 // there is no new network to migrate sessions onto, and all sessions are |
| 298 // closed. | 305 // closed. |
| 299 void MaybeMigrateOrCloseSessions( | 306 void MaybeMigrateOrCloseSessions( |
| 300 NetworkChangeNotifier::NetworkHandle new_network, | 307 NetworkChangeNotifier::NetworkHandle new_network, |
| 301 bool close_if_cannot_migrate, | 308 bool close_if_cannot_migrate, |
| 302 const BoundNetLog& bound_net_log); | 309 const BoundNetLog& bound_net_log); |
| 303 | 310 |
| 304 // Method that initiates migration of |session| if |session| is | 311 // Method that initiates migration of |session| if |session| is |
| 305 // active and if there is an alternate network than the one to which | 312 // active and if there is an alternate network than the one to which |
| 306 // |session| is currently bound. If not null, |packet| is sent on | 313 // |session| is currently bound. |
| 307 // the new network, else a PING frame is sent. | 314 MigrationResult MaybeMigrateSingleSession(QuicChromiumClientSession* session, |
| 308 void MaybeMigrateSingleSession(QuicChromiumClientSession* session, | 315 MigrationCause migration_cause); |
| 309 MigrationCause migration_cause, | |
| 310 scoped_refptr<StringIOBuffer> packet); | |
| 311 | 316 |
| 312 // Migrates |session| over to using |network|. If |network| is | 317 // Migrates |session| over to using |network|. If |network| is |
| 313 // kInvalidNetworkHandle, default network is used. If |packet| is | 318 // kInvalidNetworkHandle, default network is used. |
| 314 // not null, it is sent on the new network, else a PING frame is | 319 MigrationResult MigrateSessionToNewNetwork( |
| 315 // sent. | 320 QuicChromiumClientSession* session, |
| 316 void MigrateSessionToNewNetwork(QuicChromiumClientSession* session, | 321 NetworkChangeNotifier::NetworkHandle network, |
| 317 NetworkChangeNotifier::NetworkHandle network, | 322 bool close_session_on_error, |
| 318 bool close_session_on_error, | 323 const BoundNetLog& bound_net_log); |
| 319 const BoundNetLog& bound_net_log, | |
| 320 scoped_refptr<StringIOBuffer> packet); | |
| 321 | 324 |
| 322 // Migrates |session| over to using |peer_address|. Causes a PING frame | 325 // Migrates |session| over to using |peer_address|. Causes a PING frame |
| 323 // to be sent to the new peer address. | 326 // to be sent to the new peer address. |
| 324 void MigrateSessionToNewPeerAddress(QuicChromiumClientSession* session, | 327 void MigrateSessionToNewPeerAddress(QuicChromiumClientSession* session, |
| 325 IPEndPoint peer_address, | 328 IPEndPoint peer_address, |
| 326 const BoundNetLog& bound_net_log); | 329 const BoundNetLog& bound_net_log); |
| 327 | 330 |
| 328 // NetworkChangeNotifier::IPAddressObserver methods: | 331 // NetworkChangeNotifier::IPAddressObserver methods: |
| 329 | 332 |
| 330 // Until the servers support roaming, close all connections when the local | 333 // Until the servers support roaming, close all connections when the local |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 void ProcessGoingAwaySession(QuicChromiumClientSession* session, | 476 void ProcessGoingAwaySession(QuicChromiumClientSession* session, |
| 474 const QuicServerId& server_id, | 477 const QuicServerId& server_id, |
| 475 bool was_session_active); | 478 bool was_session_active); |
| 476 | 479 |
| 477 // Collect stats from recent connections, possibly disabling Quic. | 480 // Collect stats from recent connections, possibly disabling Quic. |
| 478 void MaybeDisableQuic(QuicChromiumClientSession* session); | 481 void MaybeDisableQuic(QuicChromiumClientSession* session); |
| 479 | 482 |
| 480 void MaybeDisableQuic(uint16_t port); | 483 void MaybeDisableQuic(uint16_t port); |
| 481 | 484 |
| 482 // Internal method that migrates |session| over to using | 485 // Internal method that migrates |session| over to using |
| 483 // |peer_address| and |network|. If |network| is kInvalidNetworkHandle, | 486 // |peer_address| and |network|. If |network| is |
| 484 // default network is used. If |packet| is not null, it is sent | 487 // kInvalidNetworkHandle, default network is used. If the migration |
| 485 // on the new network, else a PING frame is sent. | 488 // fails and |close_session_on_error| is true, connection is closed. |
| 486 void MigrateSession(QuicChromiumClientSession* session, | 489 MigrationResult MigrateSessionInner( |
| 487 IPEndPoint peer_address, | 490 QuicChromiumClientSession* session, |
| 488 NetworkChangeNotifier::NetworkHandle network, | 491 IPEndPoint peer_address, |
| 489 bool close_session_on_error, | 492 NetworkChangeNotifier::NetworkHandle network, |
| 490 const BoundNetLog& bound_net_log, | 493 bool close_session_on_error, |
| 491 scoped_refptr<StringIOBuffer> packet); | 494 const BoundNetLog& bound_net_log); |
| 492 | 495 |
| 493 bool require_confirmation_; | 496 bool require_confirmation_; |
| 494 NetLog* net_log_; | 497 NetLog* net_log_; |
| 495 HostResolver* host_resolver_; | 498 HostResolver* host_resolver_; |
| 496 ClientSocketFactory* client_socket_factory_; | 499 ClientSocketFactory* client_socket_factory_; |
| 497 HttpServerProperties* http_server_properties_; | 500 HttpServerProperties* http_server_properties_; |
| 498 TransportSecurityState* transport_security_state_; | 501 TransportSecurityState* transport_security_state_; |
| 499 CTVerifier* cert_transparency_verifier_; | 502 CTVerifier* cert_transparency_verifier_; |
| 500 std::unique_ptr<QuicServerInfoFactory> quic_server_info_factory_; | 503 std::unique_ptr<QuicServerInfoFactory> quic_server_info_factory_; |
| 501 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory_; | 504 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory_; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 const scoped_refptr<SSLConfigService> ssl_config_service_; | 668 const scoped_refptr<SSLConfigService> ssl_config_service_; |
| 666 | 669 |
| 667 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 670 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
| 668 | 671 |
| 669 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 672 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
| 670 }; | 673 }; |
| 671 | 674 |
| 672 } // namespace net | 675 } // namespace net |
| 673 | 676 |
| 674 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 677 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
| OLD | NEW |