| 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 #include "net/quic/quic_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 CREATION_ERROR_MAX | 77 CREATION_ERROR_MAX |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 enum QuicConnectionMigrationStatus { | 80 enum QuicConnectionMigrationStatus { |
| 81 MIGRATION_STATUS_NO_MIGRATABLE_STREAMS, | 81 MIGRATION_STATUS_NO_MIGRATABLE_STREAMS, |
| 82 MIGRATION_STATUS_ALREADY_MIGRATED, | 82 MIGRATION_STATUS_ALREADY_MIGRATED, |
| 83 MIGRATION_STATUS_INTERNAL_ERROR, | 83 MIGRATION_STATUS_INTERNAL_ERROR, |
| 84 MIGRATION_STATUS_TOO_MANY_CHANGES, | 84 MIGRATION_STATUS_TOO_MANY_CHANGES, |
| 85 MIGRATION_STATUS_SUCCESS, | 85 MIGRATION_STATUS_SUCCESS, |
| 86 MIGRATION_STATUS_NON_MIGRATABLE_STREAM, | 86 MIGRATION_STATUS_NON_MIGRATABLE_STREAM, |
| 87 MIGRATION_STATUS_DISABLED, |
| 87 MIGRATION_STATUS_MAX | 88 MIGRATION_STATUS_MAX |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 // The maximum receive window sizes for QUIC sessions and streams. | 91 // The maximum receive window sizes for QUIC sessions and streams. |
| 91 const int32_t kQuicSessionMaxRecvWindowSize = 15 * 1024 * 1024; // 15 MB | 92 const int32_t kQuicSessionMaxRecvWindowSize = 15 * 1024 * 1024; // 15 MB |
| 92 const int32_t kQuicStreamMaxRecvWindowSize = 6 * 1024 * 1024; // 6 MB | 93 const int32_t kQuicStreamMaxRecvWindowSize = 6 * 1024 * 1024; // 6 MB |
| 93 | 94 |
| 94 // Set the maximum number of undecryptable packets the connection will store. | 95 // Set the maximum number of undecryptable packets the connection will store. |
| 95 const int32_t kMaxUndecryptablePackets = 100; | 96 const int32_t kMaxUndecryptablePackets = 100; |
| 96 | 97 |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 OnSessionGoingAway(session); | 1337 OnSessionGoingAway(session); |
| 1337 | 1338 |
| 1338 if (new_network == NetworkChangeNotifier::kInvalidNetworkHandle) { | 1339 if (new_network == NetworkChangeNotifier::kInvalidNetworkHandle) { |
| 1339 // No new network was found. | 1340 // No new network was found. |
| 1340 if (force_close) { | 1341 if (force_close) { |
| 1341 session->CloseSessionOnError(ERR_NETWORK_CHANGED, | 1342 session->CloseSessionOnError(ERR_NETWORK_CHANGED, |
| 1342 QUIC_CONNECTION_MIGRATION_NO_NEW_NETWORK); | 1343 QUIC_CONNECTION_MIGRATION_NO_NEW_NETWORK); |
| 1343 } | 1344 } |
| 1344 continue; | 1345 continue; |
| 1345 } | 1346 } |
| 1347 if (session->config()->DisableConnectionMigration()) { |
| 1348 // Do not migrate sessions where connection migration is disabled by |
| 1349 // config. |
| 1350 if (force_close) { |
| 1351 // Close sessions where connection migration is disabled. |
| 1352 session->CloseSessionOnError(ERR_NETWORK_CHANGED, |
| 1353 QUIC_IP_ADDRESS_CHANGED); |
| 1354 HistogramMigrationStatus(MIGRATION_STATUS_DISABLED); |
| 1355 } |
| 1356 continue; |
| 1357 } |
| 1346 if (session->HasNonMigratableStreams()) { | 1358 if (session->HasNonMigratableStreams()) { |
| 1347 // Do not migrate sessions with non-migratable streams. | 1359 // Do not migrate sessions with non-migratable streams. |
| 1348 if (force_close) { | 1360 if (force_close) { |
| 1349 // Close sessions with non-migratable streams. | 1361 // Close sessions with non-migratable streams. |
| 1350 session->CloseSessionOnError( | 1362 session->CloseSessionOnError( |
| 1351 ERR_NETWORK_CHANGED, | 1363 ERR_NETWORK_CHANGED, |
| 1352 QUIC_CONNECTION_MIGRATION_NON_MIGRATABLE_STREAM); | 1364 QUIC_CONNECTION_MIGRATION_NON_MIGRATABLE_STREAM); |
| 1353 HistogramMigrationStatus(MIGRATION_STATUS_NON_MIGRATABLE_STREAM); | 1365 HistogramMigrationStatus(MIGRATION_STATUS_NON_MIGRATABLE_STREAM); |
| 1354 } | 1366 } |
| 1355 continue; | 1367 continue; |
| 1356 } | 1368 } |
| 1357 | 1369 |
| 1358 MigrateSessionToNetwork(session, new_network); | 1370 MigrateSessionToNetwork(session, new_network); |
| 1359 } | 1371 } |
| 1360 } | 1372 } |
| 1361 | 1373 |
| 1362 void QuicStreamFactory::MaybeMigrateSessionEarly( | 1374 void QuicStreamFactory::MaybeMigrateSessionEarly( |
| 1363 QuicChromiumClientSession* session) { | 1375 QuicChromiumClientSession* session) { |
| 1364 if (!migrate_sessions_early_ || session->HasNonMigratableStreams()) { | 1376 if (!migrate_sessions_early_ || session->HasNonMigratableStreams() || |
| 1377 session->config()->DisableConnectionMigration()) { |
| 1365 return; | 1378 return; |
| 1366 } | 1379 } |
| 1367 NetworkHandle new_network = | 1380 NetworkHandle new_network = |
| 1368 FindAlternateNetwork(session->GetDefaultSocket()->GetBoundNetwork()); | 1381 FindAlternateNetwork(session->GetDefaultSocket()->GetBoundNetwork()); |
| 1369 if (new_network == NetworkChangeNotifier::kInvalidNetworkHandle) { | 1382 if (new_network == NetworkChangeNotifier::kInvalidNetworkHandle) { |
| 1370 // No alternate network found. | 1383 // No alternate network found. |
| 1371 return; | 1384 return; |
| 1372 } | 1385 } |
| 1373 OnSessionGoingAway(session); | 1386 OnSessionGoingAway(session); |
| 1374 MigrateSessionToNetwork(session, new_network); | 1387 MigrateSessionToNetwork(session, new_network); |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1747 // Since the session was active, there's no longer an | 1760 // Since the session was active, there's no longer an |
| 1748 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1761 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 1749 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1762 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 1750 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1763 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 1751 // still race. | 1764 // still race. |
| 1752 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1765 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 1753 alternative_service); | 1766 alternative_service); |
| 1754 } | 1767 } |
| 1755 | 1768 |
| 1756 } // namespace net | 1769 } // namespace net |
| OLD | NEW |