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

Side by Side 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: Naming fixes. Created 5 years 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 #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 <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 CompletionCallback callback_; 100 CompletionCallback callback_;
101 scoped_ptr<QuicHttpStream> stream_; 101 scoped_ptr<QuicHttpStream> stream_;
102 102
103 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest); 103 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest);
104 }; 104 };
105 105
106 // A factory for creating new QuicHttpStreams on top of a pool of 106 // A factory for creating new QuicHttpStreams on top of a pool of
107 // QuicChromiumClientSessions. 107 // QuicChromiumClientSessions.
108 class NET_EXPORT_PRIVATE QuicStreamFactory 108 class NET_EXPORT_PRIVATE QuicStreamFactory
109 : public NetworkChangeNotifier::IPAddressObserver, 109 : public NetworkChangeNotifier::IPAddressObserver,
110 public NetworkChangeNotifier::NetworkObserver,
110 public SSLConfigService::Observer, 111 public SSLConfigService::Observer,
111 public CertDatabase::Observer { 112 public CertDatabase::Observer {
112 public: 113 public:
113 QuicStreamFactory( 114 QuicStreamFactory(
114 HostResolver* host_resolver, 115 HostResolver* host_resolver,
115 ClientSocketFactory* client_socket_factory, 116 ClientSocketFactory* client_socket_factory,
116 base::WeakPtr<HttpServerProperties> http_server_properties, 117 base::WeakPtr<HttpServerProperties> http_server_properties,
117 CertVerifier* cert_verifier, 118 CertVerifier* cert_verifier,
118 CertPolicyEnforcer* cert_policy_enforcer, 119 CertPolicyEnforcer* cert_policy_enforcer,
119 ChannelIDService* channel_id_service, 120 ChannelIDService* channel_id_service,
(...skipping 17 matching lines...) Expand all
137 int max_number_of_lossy_connections, 138 int max_number_of_lossy_connections,
138 float packet_loss_threshold, 139 float packet_loss_threshold,
139 int max_recent_disabled_reasons, 140 int max_recent_disabled_reasons,
140 int threshold_timeouts_with_streams_open, 141 int threshold_timeouts_with_streams_open,
141 int threshold_public_resets_post_handshake, 142 int threshold_public_resets_post_handshake,
142 int socket_receive_buffer_size, 143 int socket_receive_buffer_size,
143 bool delay_tcp_race, 144 bool delay_tcp_race,
144 bool store_server_configs_in_properties, 145 bool store_server_configs_in_properties,
145 bool close_sessions_on_ip_change, 146 bool close_sessions_on_ip_change,
146 int idle_connection_timeout_seconds, 147 int idle_connection_timeout_seconds,
148 bool migrate_sessions_on_network_change,
147 const QuicTagVector& connection_options); 149 const QuicTagVector& connection_options);
148 ~QuicStreamFactory() override; 150 ~QuicStreamFactory() override;
149 151
150 // Creates a new QuicHttpStream to |host_port_pair| which will be 152 // Creates a new QuicHttpStream to |host_port_pair| which will be
151 // owned by |request|. 153 // owned by |request|.
152 // If a matching session already exists, this method will return OK. If no 154 // If a matching session already exists, this method will return OK. If no
153 // matching session exists, this will return ERR_IO_PENDING and will invoke 155 // matching session exists, this will return ERR_IO_PENDING and will invoke
154 // OnRequestComplete asynchronously. 156 // OnRequestComplete asynchronously.
155 int Create(const HostPortPair& host_port_pair, 157 int Create(const HostPortPair& host_port_pair,
156 PrivacyMode privacy_mode, 158 PrivacyMode privacy_mode,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 195
194 // Called by a session whose connection has timed out. 196 // Called by a session whose connection has timed out.
195 void OnSessionConnectTimeout(QuicChromiumClientSession* session); 197 void OnSessionConnectTimeout(QuicChromiumClientSession* session);
196 198
197 // Cancels a pending request. 199 // Cancels a pending request.
198 void CancelRequest(QuicStreamRequest* request); 200 void CancelRequest(QuicStreamRequest* request);
199 201
200 // Closes all current sessions. 202 // Closes all current sessions.
201 void CloseAllSessions(int error); 203 void CloseAllSessions(int error);
202 204
205 // Closes all current sessions with specified QUIC error code.
206 void CloseAllSessionsInner(int error, QuicErrorCode quic_error);
207
203 scoped_ptr<base::Value> QuicStreamFactoryInfoToValue() const; 208 scoped_ptr<base::Value> QuicStreamFactoryInfoToValue() const;
204 209
205 // Delete all cached state objects in |crypto_config_|. 210 // Delete all cached state objects in |crypto_config_|.
206 void ClearCachedStatesInCryptoConfig(); 211 void ClearCachedStatesInCryptoConfig();
207 212
213 // Helper method that configures a DatagramClientSocket. Socket is
214 // bound to the default network if the |network| param is
215 // NetworkChangeNotifier::kInvalidNetworkHandle.
216 // Returns net_error code.
217 int ConfigureDatagramClientSocket(
218 DatagramClientSocket* socket,
219 IPEndPoint addr,
220 NetworkChangeNotifier::NetworkHandle network);
221
222 // Helper method that initiates migration of active sessions away from
223 // |network| if possible, and if not, closes them. Migration is only
224 // attempted on active sessions; idle sessions are closed.
225 void MigrateOrCloseSessions(NetworkChangeNotifier::NetworkHandle);
226
208 // NetworkChangeNotifier::IPAddressObserver methods: 227 // NetworkChangeNotifier::IPAddressObserver methods:
209 228
210 // Until the servers support roaming, close all connections when the local 229 // Until the servers support roaming, close all connections when the local
211 // IP address changes. 230 // IP address changes.
212 void OnIPAddressChanged() override; 231 void OnIPAddressChanged() override;
213 232
233 // NetworkChangeNotifier::NetworkObserver methods:
234 void OnNetworkConnected(
235 NetworkChangeNotifier::NetworkHandle network) override;
236 void OnNetworkDisconnected(
237 NetworkChangeNotifier::NetworkHandle network) override;
238 void OnNetworkSoonToDisconnect(
239 NetworkChangeNotifier::NetworkHandle network) override;
240 void OnNetworkMadeDefault(
241 NetworkChangeNotifier::NetworkHandle network) override;
242
214 // SSLConfigService::Observer methods: 243 // SSLConfigService::Observer methods:
215 244
216 // We perform the same flushing as described above when SSL settings change. 245 // We perform the same flushing as described above when SSL settings change.
217 void OnSSLConfigChanged() override; 246 void OnSSLConfigChanged() override;
218 247
219 // CertDatabase::Observer methods: 248 // CertDatabase::Observer methods:
220 249
221 // We close all sessions when certificate database is changed. 250 // We close all sessions when certificate database is changed.
222 void OnCertAdded(const X509Certificate* cert) override; 251 void OnCertAdded(const X509Certificate* cert) override;
223 void OnCACertChanged(const X509Certificate* cert) override; 252 void OnCACertChanged(const X509Certificate* cert) override;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 // QuicPacketReader::StartReading() yields by doing a PostTask(). 472 // QuicPacketReader::StartReading() yields by doing a PostTask().
444 int yield_after_packets_; 473 int yield_after_packets_;
445 QuicTime::Delta yield_after_duration_; 474 QuicTime::Delta yield_after_duration_;
446 475
447 // Set if server configs are to be stored in HttpServerProperties. 476 // Set if server configs are to be stored in HttpServerProperties.
448 bool store_server_configs_in_properties_; 477 bool store_server_configs_in_properties_;
449 478
450 // Set if all sessions should be closed when any local IP address changes. 479 // Set if all sessions should be closed when any local IP address changes.
451 const bool close_sessions_on_ip_change_; 480 const bool close_sessions_on_ip_change_;
452 481
482 // Set if migration should be attempted on active sessions when primary
483 // interface changes.
484 const bool migrate_sessions_on_network_change_;
485
453 // Each profile will (probably) have a unique port_seed_ value. This value 486 // Each profile will (probably) have a unique port_seed_ value. This value
454 // is used to help seed a pseudo-random number generator (PortSuggester) so 487 // is used to help seed a pseudo-random number generator (PortSuggester) so
455 // that we consistently (within this profile) suggest the same ephemeral 488 // that we consistently (within this profile) suggest the same ephemeral
456 // port when we re-connect to any given server/port. The differences between 489 // port when we re-connect to any given server/port. The differences between
457 // profiles (probablistically) prevent two profiles from colliding in their 490 // profiles (probablistically) prevent two profiles from colliding in their
458 // ephemeral port requests. 491 // ephemeral port requests.
459 uint64 port_seed_; 492 uint64 port_seed_;
460 493
461 // Local address of socket that was created in CreateSession. 494 // Local address of socket that was created in CreateSession.
462 IPEndPoint local_address_; 495 IPEndPoint local_address_;
463 bool check_persisted_supports_quic_; 496 bool check_persisted_supports_quic_;
464 bool has_initialized_data_; 497 bool has_initialized_data_;
465 std::set<HostPortPair> quic_supported_servers_at_startup_; 498 std::set<HostPortPair> quic_supported_servers_at_startup_;
466 499
467 NetworkConnection network_connection_; 500 NetworkConnection network_connection_;
468 501
469 base::TaskRunner* task_runner_; 502 base::TaskRunner* task_runner_;
470 503
471 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; 504 base::WeakPtrFactory<QuicStreamFactory> weak_factory_;
472 505
473 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); 506 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory);
474 }; 507 };
475 508
476 } // namespace net 509 } // namespace net
477 510
478 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ 511 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698