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

Unified Diff: net/quic/chromium/quic_stream_factory.cc

Issue 2329853002: Introduces ability for session to wait on a migration trigger for a new (Closed)
Patch Set: network notifications handled Created 4 years, 3 months 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/chromium/quic_stream_factory.cc
diff --git a/net/quic/chromium/quic_stream_factory.cc b/net/quic/chromium/quic_stream_factory.cc
index a9407a8399d96ed2141f256451bf24293e0cb1e8..30153a116d2ebb1fb85a96122dfa6c4b85d58ea9 100644
--- a/net/quic/chromium/quic_stream_factory.cc
+++ b/net/quic/chromium/quic_stream_factory.cc
@@ -71,18 +71,6 @@ enum CreateSessionFailure {
CREATION_ERROR_MAX
};
-enum QuicConnectionMigrationStatus {
- MIGRATION_STATUS_NO_MIGRATABLE_STREAMS,
- MIGRATION_STATUS_ALREADY_MIGRATED,
- MIGRATION_STATUS_INTERNAL_ERROR,
- MIGRATION_STATUS_TOO_MANY_CHANGES,
- MIGRATION_STATUS_SUCCESS,
- MIGRATION_STATUS_NON_MIGRATABLE_STREAM,
- MIGRATION_STATUS_DISABLED,
- MIGRATION_STATUS_NO_ALTERNATE_NETWORK,
- MIGRATION_STATUS_MAX
-};
-
// The maximum receive window sizes for QUIC sessions and streams.
const int32_t kQuicSessionMaxRecvWindowSize = 15 * 1024 * 1024; // 15 MB
const int32_t kQuicStreamMaxRecvWindowSize = 6 * 1024 * 1024; // 6 MB
@@ -1444,6 +1432,11 @@ void QuicStreamFactory::OnIPAddressChanged() {
void QuicStreamFactory::OnNetworkConnected(NetworkHandle network) {
num_timeouts_with_open_streams_ = 0;
status_ = OPEN;
+ ScopedConnectionMigrationEventLog scoped_event_log(net_log_,
+ "OnNetworkConnected");
+ for (auto session : all_sessions_) {
+ session.first->OnNetworkConnected(network, scoped_event_log.net_log());
+ }
Ryan Hamilton 2016/09/12 03:42:01 I expected this to call MigrateOrCloseSessions(),
Ryan Hamilton 2016/09/13 00:33:18 ping
Jana 2016/09/13 01:12:18 OnNetworkConnected can be called from the NCN when
}
void QuicStreamFactory::OnNetworkMadeDefault(NetworkHandle network) {
@@ -1479,6 +1472,7 @@ NetworkHandle QuicStreamFactory::FindAlternateNetwork(
return NetworkChangeNotifier::kInvalidNetworkHandle;
}
+// @@@ look at other cl for changes here.
Ryan Hamilton 2016/09/12 03:42:01 ?
Jana 2016/09/13 01:12:18 Leftover comment, removed.
void QuicStreamFactory::MaybeMigrateOrCloseSessions(
NetworkHandle new_network,
bool close_if_cannot_migrate,
@@ -1488,16 +1482,6 @@ void QuicStreamFactory::MaybeMigrateOrCloseSessions(
QuicChromiumClientSession* session = it->first;
++it;
- // Migration attempted, but no new network was found. Close session.
- if (new_network == NetworkChangeNotifier::kInvalidNetworkHandle) {
- HistogramAndLogMigrationFailure(
- bound_net_log, MIGRATION_STATUS_NO_ALTERNATE_NETWORK,
- session->connection_id(), "No alternate network found");
- session->CloseSessionOnError(ERR_NETWORK_CHANGED,
- QUIC_CONNECTION_MIGRATION_NO_NEW_NETWORK);
- continue;
- }
-
// If session is already bound to |new_network|, move on.
if (session->GetDefaultSocket()->GetBoundNetwork() == new_network) {
HistogramAndLogMigrationFailure(
@@ -1544,6 +1528,13 @@ void QuicStreamFactory::MaybeMigrateOrCloseSessions(
continue;
}
+ // No new network was found. Notify session, so it can wait for a
+ // new network.
+ if (new_network == NetworkChangeNotifier::kInvalidNetworkHandle) {
+ session->OnNoNewNetwork();
+ continue;
+ }
+
MigrateSessionToNewNetwork(session, new_network,
/*close_session_on_error=*/true, bound_net_log);
}
@@ -1848,8 +1839,7 @@ int QuicStreamFactory::CreateSession(
clock_.get(), transport_security_state_, std::move(server_info),
server_id, yield_after_packets_, yield_after_duration_, cert_verify_flags,
config, &crypto_config_, network_connection_.GetDescription(),
- dns_resolution_end_time, &push_promise_index_,
- base::ThreadTaskRunnerHandle::Get().get(),
+ dns_resolution_end_time, &push_promise_index_, task_runner_,
std::move(socket_performance_watcher), net_log.net_log());
all_sessions_[*session] = key; // owning pointer

Powered by Google App Engine
This is Rietveld 408576698