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

Unified Diff: net/quic/quic_stream_factory.h

Issue 1327923002: Migrates QUIC sessions to a new network when old network is (about to be) disconnected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@home
Patch Set: Fixes a few scoped_ptr issues. Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: net/quic/quic_stream_factory.h
diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h
index b46854adb166fef9ba654b2da180f511d5abdde9..3ff680e577d047819bc9e4e91d90cee376231f60 100644
--- a/net/quic/quic_stream_factory.h
+++ b/net/quic/quic_stream_factory.h
@@ -103,6 +103,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:
@@ -138,6 +139,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory
bool delay_tcp_race,
bool store_server_configs_in_properties,
bool close_sessions_on_ip_change,
+ bool migrate_sessions_on_network_change,
const QuicTagVector& connection_options);
~QuicStreamFactory() override;
@@ -199,12 +201,39 @@ class NET_EXPORT_PRIVATE QuicStreamFactory
// Delete all cached state objects in |crypto_config_|.
void ClearCachedStatesInCryptoConfig();
+ // Helper method that creates and returns a DatagramClientSocket.
+ scoped_ptr<DatagramClientSocket> CreateDatagramClientSocket(
+ const QuicServerId& server_id,
+ const BoundNetLog& net_log);
+
+ // Helper method that configures a DatagramClientSocket.
+ // Returns net_error code.
+ int ConfigureDatagramClientSocket(
+ DatagramClientSocket* socket,
+ IPEndPoint addr,
+ NetworkChangeNotifier::NetworkHandle network);
+
+ // Helper method that initiates migration of active sessions away from
+ // |network| if possible, and if not, closes them. Migration is only
+ // attempted on active sessions; idle sessions are closed.
+ void MigrateOrCloseSessions(NetworkChangeNotifier::NetworkHandle);
+
// NetworkChangeNotifier::IPAddressObserver methods:
// Until the servers support roaming, close all connections when the local
// IP address changes.
void OnIPAddressChanged() override;
+ // NetworkChangeNotifier::NetworkObserver methods:
+ void OnNetworkConnected(
+ NetworkChangeNotifier::NetworkHandle network) override;
+ void OnNetworkDisconnected(
+ NetworkChangeNotifier::NetworkHandle network) override;
+ void OnNetworkSoonToDisconnect(
+ NetworkChangeNotifier::NetworkHandle network) override;
+ void OnNetworkMadeDefault(
+ NetworkChangeNotifier::NetworkHandle network) override;
+
// SSLConfigService::Observer methods:
// We perform the same flushing as described above when SSL settings change.
@@ -441,6 +470,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

Powered by Google App Engine
This is Rietveld 408576698