Chromium Code Reviews| 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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 564 int max_disabled_reasons, | 564 int max_disabled_reasons, |
| 565 int threshold_public_resets_post_handshake, | 565 int threshold_public_resets_post_handshake, |
| 566 int threshold_timeouts_with_open_streams, | 566 int threshold_timeouts_with_open_streams, |
| 567 int socket_receive_buffer_size, | 567 int socket_receive_buffer_size, |
| 568 bool delay_tcp_race, | 568 bool delay_tcp_race, |
| 569 int max_server_configs_stored_in_properties, | 569 int max_server_configs_stored_in_properties, |
| 570 bool close_sessions_on_ip_change, | 570 bool close_sessions_on_ip_change, |
| 571 bool disable_quic_on_timeout_with_open_streams, | 571 bool disable_quic_on_timeout_with_open_streams, |
| 572 int idle_connection_timeout_seconds, | 572 int idle_connection_timeout_seconds, |
| 573 bool migrate_sessions_on_network_change, | 573 bool migrate_sessions_on_network_change, |
| 574 bool migrate_sessions_early, | |
| 574 const QuicTagVector& connection_options) | 575 const QuicTagVector& connection_options) |
| 575 : require_confirmation_(true), | 576 : require_confirmation_(true), |
| 576 host_resolver_(host_resolver), | 577 host_resolver_(host_resolver), |
| 577 client_socket_factory_(client_socket_factory), | 578 client_socket_factory_(client_socket_factory), |
| 578 http_server_properties_(http_server_properties), | 579 http_server_properties_(http_server_properties), |
| 579 transport_security_state_(transport_security_state), | 580 transport_security_state_(transport_security_state), |
| 580 cert_transparency_verifier_(cert_transparency_verifier), | 581 cert_transparency_verifier_(cert_transparency_verifier), |
| 581 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 582 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
| 582 random_generator_(random_generator), | 583 random_generator_(random_generator), |
| 583 clock_(clock), | 584 clock_(clock), |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 613 threshold_public_resets_post_handshake), | 614 threshold_public_resets_post_handshake), |
| 614 socket_receive_buffer_size_(socket_receive_buffer_size), | 615 socket_receive_buffer_size_(socket_receive_buffer_size), |
| 615 delay_tcp_race_(delay_tcp_race), | 616 delay_tcp_race_(delay_tcp_race), |
| 616 yield_after_packets_(kQuicYieldAfterPacketsRead), | 617 yield_after_packets_(kQuicYieldAfterPacketsRead), |
| 617 yield_after_duration_(QuicTime::Delta::FromMilliseconds( | 618 yield_after_duration_(QuicTime::Delta::FromMilliseconds( |
| 618 kQuicYieldAfterDurationMilliseconds)), | 619 kQuicYieldAfterDurationMilliseconds)), |
| 619 close_sessions_on_ip_change_(close_sessions_on_ip_change), | 620 close_sessions_on_ip_change_(close_sessions_on_ip_change), |
| 620 migrate_sessions_on_network_change_( | 621 migrate_sessions_on_network_change_( |
| 621 migrate_sessions_on_network_change && | 622 migrate_sessions_on_network_change && |
| 622 NetworkChangeNotifier::AreNetworkHandlesSupported()), | 623 NetworkChangeNotifier::AreNetworkHandlesSupported()), |
| 624 migrate_sessions_early_(migrate_sessions_early && | |
| 625 migrate_sessions_on_network_change_), | |
| 623 port_seed_(random_generator_->RandUint64()), | 626 port_seed_(random_generator_->RandUint64()), |
| 624 check_persisted_supports_quic_(true), | 627 check_persisted_supports_quic_(true), |
| 625 has_initialized_data_(false), | 628 has_initialized_data_(false), |
| 626 task_runner_(nullptr), | 629 task_runner_(nullptr), |
| 627 weak_factory_(this) { | 630 weak_factory_(this) { |
| 628 if (disable_quic_on_timeout_with_open_streams) | 631 if (disable_quic_on_timeout_with_open_streams) |
| 629 threshold_timeouts_with_open_streams_ = 1; | 632 threshold_timeouts_with_open_streams_ = 1; |
| 630 DCHECK(transport_security_state_); | 633 DCHECK(transport_security_state_); |
| 631 DCHECK(http_server_properties_); | 634 DCHECK(http_server_properties_); |
| 632 crypto_config_.set_user_agent_id(user_agent_id); | 635 crypto_config_.set_user_agent_id(user_agent_id); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 653 if (!IsEcdsaSupported()) | 656 if (!IsEcdsaSupported()) |
| 654 crypto_config_.DisableEcdsa(); | 657 crypto_config_.DisableEcdsa(); |
| 655 // When disk cache is used to store the server configs, HttpCache code calls | 658 // When disk cache is used to store the server configs, HttpCache code calls |
| 656 // |set_quic_server_info_factory| if |quic_server_info_factory_| wasn't | 659 // |set_quic_server_info_factory| if |quic_server_info_factory_| wasn't |
| 657 // created. | 660 // created. |
| 658 if (max_server_configs_stored_in_properties > 0) { | 661 if (max_server_configs_stored_in_properties > 0) { |
| 659 quic_server_info_factory_.reset( | 662 quic_server_info_factory_.reset( |
| 660 new PropertiesBasedQuicServerInfoFactory(http_server_properties_)); | 663 new PropertiesBasedQuicServerInfoFactory(http_server_properties_)); |
| 661 } | 664 } |
| 662 | 665 |
| 663 DCHECK( | 666 DCHECK(!close_sessions_on_ip_change_ || !migrate_sessions_on_network_change_); |
| 664 !(close_sessions_on_ip_change_ && migrate_sessions_on_network_change_)); | 667 DCHECK(migrate_sessions_on_network_change_ || !migrate_sessions_early_); |
|
Ryan Hamilton
2016/02/02 04:19:59
Can you add comments for these two blocks? These e
Jana
2016/02/02 06:53:53
Done.
| |
| 665 if (migrate_sessions_on_network_change_) { | 668 if (migrate_sessions_on_network_change_) { |
| 666 NetworkChangeNotifier::AddNetworkObserver(this); | 669 NetworkChangeNotifier::AddNetworkObserver(this); |
| 667 } else if (close_sessions_on_ip_change_) { | 670 } else if (close_sessions_on_ip_change_) { |
| 668 NetworkChangeNotifier::AddIPAddressObserver(this); | 671 NetworkChangeNotifier::AddIPAddressObserver(this); |
| 669 } | 672 } |
| 670 } | 673 } |
| 671 | 674 |
| 672 QuicStreamFactory::~QuicStreamFactory() { | 675 QuicStreamFactory::~QuicStreamFactory() { |
| 673 CloseAllSessions(ERR_ABORTED, QUIC_INTERNAL_ERROR); | 676 CloseAllSessions(ERR_ABORTED, QUIC_INTERNAL_ERROR); |
| 674 while (!all_sessions_.empty()) { | 677 while (!all_sessions_.empty()) { |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1231 if (force_close) { | 1234 if (force_close) { |
| 1232 session->CloseSessionOnError(ERR_NETWORK_CHANGED, | 1235 session->CloseSessionOnError(ERR_NETWORK_CHANGED, |
| 1233 QUIC_CONNECTION_MIGRATION_NO_NEW_NETWORK); | 1236 QUIC_CONNECTION_MIGRATION_NO_NEW_NETWORK); |
| 1234 } | 1237 } |
| 1235 continue; | 1238 continue; |
| 1236 } | 1239 } |
| 1237 MigrateSessionToNetwork(session, new_network); | 1240 MigrateSessionToNetwork(session, new_network); |
| 1238 } | 1241 } |
| 1239 } | 1242 } |
| 1240 | 1243 |
| 1241 void QuicStreamFactory::MaybeMigrateSessionEarly( | 1244 void QuicStreamFactory::MaybeMigrateSessionEarly( |
|
Ryan Hamilton
2016/02/02 04:19:59
Was this landed post-review, or did I miss it in t
Jana
2016/02/02 06:53:53
This got added post-LGTM, and I am pretty sure it
| |
| 1242 QuicChromiumClientSession* session) { | 1245 QuicChromiumClientSession* session) { |
| 1243 if (session->GetNumActiveStreams() == 0) { | 1246 if (!migrate_sessions_early_ || (session->GetNumActiveStreams() == 0)) { |
| 1244 return; | 1247 return; |
| 1245 } | 1248 } |
| 1246 NetworkChangeNotifier::NetworkHandle current_network = | 1249 NetworkChangeNotifier::NetworkHandle current_network = |
| 1247 session->GetDefaultSocket()->GetBoundNetwork(); | 1250 session->GetDefaultSocket()->GetBoundNetwork(); |
| 1248 NetworkChangeNotifier::NetworkHandle new_network = | 1251 NetworkChangeNotifier::NetworkHandle new_network = |
| 1249 FindAlternateNetwork(current_network); | 1252 FindAlternateNetwork(current_network); |
| 1250 if (new_network == NetworkChangeNotifier::kInvalidNetworkHandle) { | 1253 if (new_network == NetworkChangeNotifier::kInvalidNetworkHandle) { |
| 1251 // No alternate network found. | 1254 // No alternate network found. |
| 1252 return; | 1255 return; |
| 1253 } | 1256 } |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1625 // Since the session was active, there's no longer an | 1628 // Since the session was active, there's no longer an |
| 1626 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1629 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 1627 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1630 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 1628 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1631 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 1629 // still race. | 1632 // still race. |
| 1630 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1633 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 1631 alternative_service); | 1634 alternative_service); |
| 1632 } | 1635 } |
| 1633 | 1636 |
| 1634 } // namespace net | 1637 } // namespace net |
| OLD | NEW |