| 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 <tuple> | 8 #include <tuple> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 bool enable_connection_racing, | 580 bool enable_connection_racing, |
| 581 bool enable_non_blocking_io, | 581 bool enable_non_blocking_io, |
| 582 bool disable_disk_cache, | 582 bool disable_disk_cache, |
| 583 bool prefer_aes, | 583 bool prefer_aes, |
| 584 int max_number_of_lossy_connections, | 584 int max_number_of_lossy_connections, |
| 585 float packet_loss_threshold, | 585 float packet_loss_threshold, |
| 586 int max_disabled_reasons, | 586 int max_disabled_reasons, |
| 587 int threshold_public_resets_post_handshake, | 587 int threshold_public_resets_post_handshake, |
| 588 int threshold_timeouts_with_open_streams, | 588 int threshold_timeouts_with_open_streams, |
| 589 int socket_receive_buffer_size, | 589 int socket_receive_buffer_size, |
| 590 bool delay_tcp_race, |
| 590 int max_server_configs_stored_in_properties, | 591 int max_server_configs_stored_in_properties, |
| 591 bool close_sessions_on_ip_change, | 592 bool close_sessions_on_ip_change, |
| 592 bool disable_quic_on_timeout_with_open_streams, | 593 bool disable_quic_on_timeout_with_open_streams, |
| 593 int idle_connection_timeout_seconds, | 594 int idle_connection_timeout_seconds, |
| 594 bool migrate_sessions_on_network_change, | 595 bool migrate_sessions_on_network_change, |
| 595 bool migrate_sessions_early, | 596 bool migrate_sessions_early, |
| 596 const QuicTagVector& connection_options, | 597 const QuicTagVector& connection_options, |
| 597 bool enable_token_binding) | 598 bool enable_token_binding) |
| 598 : require_confirmation_(true), | 599 : require_confirmation_(true), |
| 599 host_resolver_(host_resolver), | 600 host_resolver_(host_resolver), |
| (...skipping 28 matching lines...) Expand all Loading... |
| 628 max_disabled_reasons_(max_disabled_reasons), | 629 max_disabled_reasons_(max_disabled_reasons), |
| 629 num_public_resets_post_handshake_(0), | 630 num_public_resets_post_handshake_(0), |
| 630 num_timeouts_with_open_streams_(0), | 631 num_timeouts_with_open_streams_(0), |
| 631 max_public_resets_post_handshake_(0), | 632 max_public_resets_post_handshake_(0), |
| 632 max_timeouts_with_open_streams_(0), | 633 max_timeouts_with_open_streams_(0), |
| 633 threshold_timeouts_with_open_streams_( | 634 threshold_timeouts_with_open_streams_( |
| 634 threshold_timeouts_with_open_streams), | 635 threshold_timeouts_with_open_streams), |
| 635 threshold_public_resets_post_handshake_( | 636 threshold_public_resets_post_handshake_( |
| 636 threshold_public_resets_post_handshake), | 637 threshold_public_resets_post_handshake), |
| 637 socket_receive_buffer_size_(socket_receive_buffer_size), | 638 socket_receive_buffer_size_(socket_receive_buffer_size), |
| 639 delay_tcp_race_(delay_tcp_race), |
| 638 yield_after_packets_(kQuicYieldAfterPacketsRead), | 640 yield_after_packets_(kQuicYieldAfterPacketsRead), |
| 639 yield_after_duration_(QuicTime::Delta::FromMilliseconds( | 641 yield_after_duration_(QuicTime::Delta::FromMilliseconds( |
| 640 kQuicYieldAfterDurationMilliseconds)), | 642 kQuicYieldAfterDurationMilliseconds)), |
| 641 close_sessions_on_ip_change_(close_sessions_on_ip_change), | 643 close_sessions_on_ip_change_(close_sessions_on_ip_change), |
| 642 migrate_sessions_on_network_change_( | 644 migrate_sessions_on_network_change_( |
| 643 migrate_sessions_on_network_change && | 645 migrate_sessions_on_network_change && |
| 644 NetworkChangeNotifier::AreNetworkHandlesSupported()), | 646 NetworkChangeNotifier::AreNetworkHandlesSupported()), |
| 645 migrate_sessions_early_(migrate_sessions_early && | 647 migrate_sessions_early_(migrate_sessions_early && |
| 646 migrate_sessions_on_network_change_), | 648 migrate_sessions_on_network_change_), |
| 647 port_seed_(random_generator_->RandUint64()), | 649 port_seed_(random_generator_->RandUint64()), |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 local_address_.address()); | 726 local_address_.address()); |
| 725 } | 727 } |
| 726 } | 728 } |
| 727 | 729 |
| 728 bool QuicStreamFactory::ZeroRTTEnabledFor(const QuicServerId& quic_server_id) { | 730 bool QuicStreamFactory::ZeroRTTEnabledFor(const QuicServerId& quic_server_id) { |
| 729 return !(require_confirmation_ || CryptoConfigCacheIsEmpty(quic_server_id)); | 731 return !(require_confirmation_ || CryptoConfigCacheIsEmpty(quic_server_id)); |
| 730 } | 732 } |
| 731 | 733 |
| 732 base::TimeDelta QuicStreamFactory::GetTimeDelayForWaitingJob( | 734 base::TimeDelta QuicStreamFactory::GetTimeDelayForWaitingJob( |
| 733 const QuicServerId& server_id) { | 735 const QuicServerId& server_id) { |
| 734 if (require_confirmation_) | 736 if (!delay_tcp_race_ || require_confirmation_) |
| 735 return base::TimeDelta(); | 737 return base::TimeDelta(); |
| 736 int64_t srtt = | 738 int64_t srtt = |
| 737 1.5 * GetServerNetworkStatsSmoothedRttInMicroseconds(server_id); | 739 1.5 * GetServerNetworkStatsSmoothedRttInMicroseconds(server_id); |
| 738 // Picked 300ms based on mean time from | 740 // Picked 300ms based on mean time from |
| 739 // Net.QuicSession.HostResolution.HandshakeConfirmedTime histogram. | 741 // Net.QuicSession.HostResolution.HandshakeConfirmedTime histogram. |
| 740 const int kDefaultRTT = 300 * kNumMicrosPerMilli; | 742 const int kDefaultRTT = 300 * kNumMicrosPerMilli; |
| 741 if (!srtt) | 743 if (!srtt) |
| 742 srtt = kDefaultRTT; | 744 srtt = kDefaultRTT; |
| 743 return base::TimeDelta::FromMicroseconds(srtt); | 745 return base::TimeDelta::FromMicroseconds(srtt); |
| 744 } | 746 } |
| (...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1787 // Since the session was active, there's no longer an | 1789 // Since the session was active, there's no longer an |
| 1788 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1790 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 1789 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1791 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 1790 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1792 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 1791 // still race. | 1793 // still race. |
| 1792 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1794 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 1793 alternative_service); | 1795 alternative_service); |
| 1794 } | 1796 } |
| 1795 | 1797 |
| 1796 } // namespace net | 1798 } // namespace net |
| OLD | NEW |