Chromium Code Reviews| Index: net/quic/quic_stream_factory.h |
| diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h |
| index fd317d669d690757c537aae0a95b21f20f763961..0b02e4743a80e2738814cd8bdba17376037278d1 100644 |
| --- a/net/quic/quic_stream_factory.h |
| +++ b/net/quic/quic_stream_factory.h |
| @@ -111,6 +111,7 @@ class NET_EXPORT_PRIVATE QuicStreamRequest { |
| // QuicChromiumClientSessions. |
| class NET_EXPORT_PRIVATE QuicStreamFactory |
| : public NetworkChangeNotifier::IPAddressObserver, |
| + public NetworkChangeNotifier::NetworkObserver, |
| public SSLConfigService::Observer, |
| public CertDatabase::Observer { |
| public: |
| @@ -148,6 +149,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory |
| bool store_server_configs_in_properties, |
| bool close_sessions_on_ip_change, |
| int idle_connection_timeout_seconds, |
| + bool migrate_sessions_on_network_change, |
| const QuicTagVector& connection_options); |
| ~QuicStreamFactory() override; |
| @@ -201,20 +203,58 @@ class NET_EXPORT_PRIVATE QuicStreamFactory |
| // Cancels a pending request. |
| void CancelRequest(QuicStreamRequest* request); |
| - // Closes all current sessions. |
| - void CloseAllSessions(int error); |
| + // Closes all current sessions with specified network and QUIC error codes. |
| + void CloseAllSessions(int error, QuicErrorCode quic_error); |
| scoped_ptr<base::Value> QuicStreamFactoryInfoToValue() const; |
| // Delete all cached state objects in |crypto_config_|. |
| void ClearCachedStatesInCryptoConfig(); |
| + // Helper method that configures a DatagramClientSocket. Socket is |
| + // bound to the default network if the |network| param is |
| + // NetworkChangeNotifier::kInvalidNetworkHandle. |
| + // Returns net_error code. |
| + int ConfigureSocket(DatagramClientSocket* socket, |
| + IPEndPoint addr, |
| + NetworkChangeNotifier::NetworkHandle network); |
| + |
| + // Helper method that initiates migration of active sessions |
| + // currently bound to |network| to an alternate network, if one |
| + // exists. Idle sessions bound to |network| are closed. If there is |
| + // no alternate network to migrate active sessions onto, active |
| + // sessions are closed if |force_close| is true, and continue using |
| + // |network| otherwise. Sessions not bound to |network| are left unchanged. |
| + void MaybeMigrateOrCloseSessions(NetworkChangeNotifier::NetworkHandle network, |
| + bool force_close); |
| + |
| // NetworkChangeNotifier::IPAddressObserver methods: |
| // Until the servers support roaming, close all connections when the local |
| // IP address changes. |
| void OnIPAddressChanged() override; |
| + // NetworkChangeNotifier::NetworkObserver methods: |
| + |
| + // Called when device connects to |network|. For example device associates |
| + // with a WiFi access point. This does not imply the network has Internet |
| + // access as it may well be behind a captive portal. |
| + void OnNetworkConnected( |
| + NetworkChangeNotifier::NetworkHandle network) override; |
| + // Called when device disconnects from |network|. |
| + void OnNetworkDisconnected( |
| + NetworkChangeNotifier::NetworkHandle network) override; |
| + // Called when device determines the connection to |network| is no longer |
| + // preferred, for example when a device transitions from cellular to WiFi |
| + // it might deem the cellular connection no longer preferred. The device |
| + // will disconnect from |network| in a period of time (30s on Android), |
| + // allowing network communications via |network| to wrap up. |
| + void OnNetworkSoonToDisconnect( |
| + NetworkChangeNotifier::NetworkHandle network) override; |
| + // Called when |network| is made the default network for communication. |
|
Ryan Hamilton
2016/01/08 05:01:06
nit: the style guide suggests that these comments
Jana
2016/01/09 02:06:53
I removed the comments, since they were redundant.
|
| + void OnNetworkMadeDefault( |
| + NetworkChangeNotifier::NetworkHandle network) override; |
| + |
| // SSLConfigService::Observer methods: |
| // We perform the same flushing as described above when SSL settings change. |
| @@ -452,6 +492,10 @@ class NET_EXPORT_PRIVATE QuicStreamFactory |
| // Set if all sessions should be closed when any local IP address changes. |
| const bool close_sessions_on_ip_change_; |
| + // Set if migration should be attempted on active sessions when primary |
| + // interface changes. |
| + const bool migrate_sessions_on_network_change_; |
| + |
| // Each profile will (probably) have a unique port_seed_ value. This value |
| // is used to help seed a pseudo-random number generator (PortSuggester) so |
| // that we consistently (within this profile) suggest the same ephemeral |