| 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 bool enable_non_blocking_io, | 579 bool enable_non_blocking_io, |
| 580 bool disable_disk_cache, | 580 bool disable_disk_cache, |
| 581 bool prefer_aes, | 581 bool prefer_aes, |
| 582 int max_number_of_lossy_connections, | 582 int max_number_of_lossy_connections, |
| 583 float packet_loss_threshold, | 583 float packet_loss_threshold, |
| 584 int max_disabled_reasons, | 584 int max_disabled_reasons, |
| 585 int threshold_public_resets_post_handshake, | 585 int threshold_public_resets_post_handshake, |
| 586 int threshold_timeouts_with_open_streams, | 586 int threshold_timeouts_with_open_streams, |
| 587 int socket_receive_buffer_size, | 587 int socket_receive_buffer_size, |
| 588 bool delay_tcp_race, | 588 bool delay_tcp_race, |
| 589 bool store_server_configs_in_properties, | 589 int max_server_configs_stored_in_properties, |
| 590 bool close_sessions_on_ip_change, | 590 bool close_sessions_on_ip_change, |
| 591 int idle_connection_timeout_seconds, | 591 int idle_connection_timeout_seconds, |
| 592 bool migrate_sessions_on_network_change, | 592 bool migrate_sessions_on_network_change, |
| 593 const QuicTagVector& connection_options) | 593 const QuicTagVector& connection_options) |
| 594 : require_confirmation_(true), | 594 : require_confirmation_(true), |
| 595 host_resolver_(host_resolver), | 595 host_resolver_(host_resolver), |
| 596 client_socket_factory_(client_socket_factory), | 596 client_socket_factory_(client_socket_factory), |
| 597 http_server_properties_(http_server_properties), | 597 http_server_properties_(http_server_properties), |
| 598 transport_security_state_(transport_security_state), | 598 transport_security_state_(transport_security_state), |
| 599 cert_transparency_verifier_(cert_transparency_verifier), | 599 cert_transparency_verifier_(cert_transparency_verifier), |
| (...skipping 28 matching lines...) Expand all Loading... |
| 628 max_timeouts_with_open_streams_(0), | 628 max_timeouts_with_open_streams_(0), |
| 629 threshold_timeouts_with_open_streams_( | 629 threshold_timeouts_with_open_streams_( |
| 630 threshold_timeouts_with_open_streams), | 630 threshold_timeouts_with_open_streams), |
| 631 threshold_public_resets_post_handshake_( | 631 threshold_public_resets_post_handshake_( |
| 632 threshold_public_resets_post_handshake), | 632 threshold_public_resets_post_handshake), |
| 633 socket_receive_buffer_size_(socket_receive_buffer_size), | 633 socket_receive_buffer_size_(socket_receive_buffer_size), |
| 634 delay_tcp_race_(delay_tcp_race), | 634 delay_tcp_race_(delay_tcp_race), |
| 635 yield_after_packets_(kQuicYieldAfterPacketsRead), | 635 yield_after_packets_(kQuicYieldAfterPacketsRead), |
| 636 yield_after_duration_(QuicTime::Delta::FromMilliseconds( | 636 yield_after_duration_(QuicTime::Delta::FromMilliseconds( |
| 637 kQuicYieldAfterDurationMilliseconds)), | 637 kQuicYieldAfterDurationMilliseconds)), |
| 638 store_server_configs_in_properties_(store_server_configs_in_properties), | |
| 639 close_sessions_on_ip_change_(close_sessions_on_ip_change), | 638 close_sessions_on_ip_change_(close_sessions_on_ip_change), |
| 640 migrate_sessions_on_network_change_( | 639 migrate_sessions_on_network_change_( |
| 641 migrate_sessions_on_network_change && | 640 migrate_sessions_on_network_change && |
| 642 NetworkChangeNotifier::AreNetworkHandlesSupported()), | 641 NetworkChangeNotifier::AreNetworkHandlesSupported()), |
| 643 port_seed_(random_generator_->RandUint64()), | 642 port_seed_(random_generator_->RandUint64()), |
| 644 check_persisted_supports_quic_(true), | 643 check_persisted_supports_quic_(true), |
| 645 has_initialized_data_(false), | 644 has_initialized_data_(false), |
| 646 task_runner_(nullptr), | 645 task_runner_(nullptr), |
| 647 weak_factory_(this) { | 646 weak_factory_(this) { |
| 648 DCHECK(transport_security_state_); | 647 DCHECK(transport_security_state_); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 666 #endif | 665 #endif |
| 667 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.PreferAesGcm", | 666 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.PreferAesGcm", |
| 668 has_aes_hardware_support); | 667 has_aes_hardware_support); |
| 669 if (has_aes_hardware_support || prefer_aes_) | 668 if (has_aes_hardware_support || prefer_aes_) |
| 670 crypto_config_.PreferAesGcm(); | 669 crypto_config_.PreferAesGcm(); |
| 671 if (!IsEcdsaSupported()) | 670 if (!IsEcdsaSupported()) |
| 672 crypto_config_.DisableEcdsa(); | 671 crypto_config_.DisableEcdsa(); |
| 673 // When disk cache is used to store the server configs, HttpCache code calls | 672 // When disk cache is used to store the server configs, HttpCache code calls |
| 674 // |set_quic_server_info_factory| if |quic_server_info_factory_| wasn't | 673 // |set_quic_server_info_factory| if |quic_server_info_factory_| wasn't |
| 675 // created. | 674 // created. |
| 676 if (store_server_configs_in_properties_) { | 675 if (max_server_configs_stored_in_properties > 0) { |
| 677 quic_server_info_factory_.reset( | 676 quic_server_info_factory_.reset( |
| 678 new PropertiesBasedQuicServerInfoFactory(http_server_properties_)); | 677 new PropertiesBasedQuicServerInfoFactory(http_server_properties_)); |
| 679 } | 678 } |
| 680 | 679 |
| 681 DCHECK( | 680 DCHECK( |
| 682 !(close_sessions_on_ip_change_ && migrate_sessions_on_network_change_)); | 681 !(close_sessions_on_ip_change_ && migrate_sessions_on_network_change_)); |
| 683 if (migrate_sessions_on_network_change_) { | 682 if (migrate_sessions_on_network_change_) { |
| 684 NetworkChangeNotifier::AddNetworkObserver(this); | 683 NetworkChangeNotifier::AddNetworkObserver(this); |
| 685 } else if (close_sessions_on_ip_change_) { | 684 } else if (close_sessions_on_ip_change_) { |
| 686 NetworkChangeNotifier::AddIPAddressObserver(this); | 685 NetworkChangeNotifier::AddIPAddressObserver(this); |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 key_value : http_server_properties_->alternative_service_map()) { | 1558 key_value : http_server_properties_->alternative_service_map()) { |
| 1560 for (const AlternativeServiceInfo& alternative_service_info : | 1559 for (const AlternativeServiceInfo& alternative_service_info : |
| 1561 key_value.second) { | 1560 key_value.second) { |
| 1562 if (alternative_service_info.alternative_service.protocol == QUIC) { | 1561 if (alternative_service_info.alternative_service.protocol == QUIC) { |
| 1563 quic_supported_servers_at_startup_.insert(key_value.first); | 1562 quic_supported_servers_at_startup_.insert(key_value.first); |
| 1564 break; | 1563 break; |
| 1565 } | 1564 } |
| 1566 } | 1565 } |
| 1567 } | 1566 } |
| 1568 | 1567 |
| 1569 if (!store_server_configs_in_properties_) | 1568 if (http_server_properties_->max_server_configs_stored_in_properties() == 0) |
| 1570 return; | 1569 return; |
| 1571 // Create a temporary QuicServerInfo object to deserialize and to populate the | 1570 // Create a temporary QuicServerInfo object to deserialize and to populate the |
| 1572 // in-memory crypto server config cache. | 1571 // in-memory crypto server config cache. |
| 1573 scoped_ptr<QuicServerInfo> server_info; | 1572 scoped_ptr<QuicServerInfo> server_info; |
| 1574 CompletionCallback callback; | 1573 CompletionCallback callback; |
| 1575 for (const auto& key_value : | 1574 for (const auto& key_value : |
| 1576 http_server_properties_->quic_server_info_map()) { | 1575 http_server_properties_->quic_server_info_map()) { |
| 1577 const QuicServerId& server_id = key_value.first; | 1576 const QuicServerId& server_id = key_value.first; |
| 1578 server_info.reset(quic_server_info_factory_->GetForServer(server_id)); | 1577 server_info.reset(quic_server_info_factory_->GetForServer(server_id)); |
| 1579 if (server_info->WaitForDataReady(callback) == OK) { | 1578 if (server_info->WaitForDataReady(callback) == OK) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 // Since the session was active, there's no longer an | 1618 // Since the session was active, there's no longer an |
| 1620 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1619 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 1621 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1620 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 1622 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1621 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 1623 // still race. | 1622 // still race. |
| 1624 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1623 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 1625 alternative_service); | 1624 alternative_service); |
| 1626 } | 1625 } |
| 1627 | 1626 |
| 1628 } // namespace net | 1627 } // namespace net |
| OLD | NEW |