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 <utility> | 8 #include <utility> |
9 | 9 |
10 #include <openssl/aead.h> | 10 #include <openssl/aead.h> |
(...skipping 576 matching lines...) Loading... |
587 bool enable_connection_racing, | 587 bool enable_connection_racing, |
588 bool enable_non_blocking_io, | 588 bool enable_non_blocking_io, |
589 bool disable_disk_cache, | 589 bool disable_disk_cache, |
590 bool prefer_aes, | 590 bool prefer_aes, |
591 int max_number_of_lossy_connections, | 591 int max_number_of_lossy_connections, |
592 float packet_loss_threshold, | 592 float packet_loss_threshold, |
593 int max_disabled_reasons, | 593 int max_disabled_reasons, |
594 int threshold_public_resets_post_handshake, | 594 int threshold_public_resets_post_handshake, |
595 int threshold_timeouts_with_open_streams, | 595 int threshold_timeouts_with_open_streams, |
596 int socket_receive_buffer_size, | 596 int socket_receive_buffer_size, |
| 597 bool delay_tcp_race, |
597 int max_server_configs_stored_in_properties, | 598 int max_server_configs_stored_in_properties, |
598 bool close_sessions_on_ip_change, | 599 bool close_sessions_on_ip_change, |
599 bool disable_quic_on_timeout_with_open_streams, | 600 bool disable_quic_on_timeout_with_open_streams, |
600 int idle_connection_timeout_seconds, | 601 int idle_connection_timeout_seconds, |
601 bool migrate_sessions_on_network_change, | 602 bool migrate_sessions_on_network_change, |
602 bool migrate_sessions_early, | 603 bool migrate_sessions_early, |
603 const QuicTagVector& connection_options, | 604 const QuicTagVector& connection_options, |
604 bool enable_token_binding) | 605 bool enable_token_binding) |
605 : require_confirmation_(true), | 606 : require_confirmation_(true), |
606 host_resolver_(host_resolver), | 607 host_resolver_(host_resolver), |
(...skipping 28 matching lines...) Loading... |
635 max_disabled_reasons_(max_disabled_reasons), | 636 max_disabled_reasons_(max_disabled_reasons), |
636 num_public_resets_post_handshake_(0), | 637 num_public_resets_post_handshake_(0), |
637 num_timeouts_with_open_streams_(0), | 638 num_timeouts_with_open_streams_(0), |
638 max_public_resets_post_handshake_(0), | 639 max_public_resets_post_handshake_(0), |
639 max_timeouts_with_open_streams_(0), | 640 max_timeouts_with_open_streams_(0), |
640 threshold_timeouts_with_open_streams_( | 641 threshold_timeouts_with_open_streams_( |
641 threshold_timeouts_with_open_streams), | 642 threshold_timeouts_with_open_streams), |
642 threshold_public_resets_post_handshake_( | 643 threshold_public_resets_post_handshake_( |
643 threshold_public_resets_post_handshake), | 644 threshold_public_resets_post_handshake), |
644 socket_receive_buffer_size_(socket_receive_buffer_size), | 645 socket_receive_buffer_size_(socket_receive_buffer_size), |
| 646 delay_tcp_race_(delay_tcp_race), |
645 yield_after_packets_(kQuicYieldAfterPacketsRead), | 647 yield_after_packets_(kQuicYieldAfterPacketsRead), |
646 yield_after_duration_(QuicTime::Delta::FromMilliseconds( | 648 yield_after_duration_(QuicTime::Delta::FromMilliseconds( |
647 kQuicYieldAfterDurationMilliseconds)), | 649 kQuicYieldAfterDurationMilliseconds)), |
648 close_sessions_on_ip_change_(close_sessions_on_ip_change), | 650 close_sessions_on_ip_change_(close_sessions_on_ip_change), |
649 migrate_sessions_on_network_change_( | 651 migrate_sessions_on_network_change_( |
650 migrate_sessions_on_network_change && | 652 migrate_sessions_on_network_change && |
651 NetworkChangeNotifier::AreNetworkHandlesSupported()), | 653 NetworkChangeNotifier::AreNetworkHandlesSupported()), |
652 migrate_sessions_early_(migrate_sessions_early && | 654 migrate_sessions_early_(migrate_sessions_early && |
653 migrate_sessions_on_network_change_), | 655 migrate_sessions_on_network_change_), |
654 port_seed_(random_generator_->RandUint64()), | 656 port_seed_(random_generator_->RandUint64()), |
(...skipping 76 matching lines...) Loading... |
731 local_address_.address()); | 733 local_address_.address()); |
732 } | 734 } |
733 } | 735 } |
734 | 736 |
735 bool QuicStreamFactory::ZeroRTTEnabledFor(const QuicServerId& quic_server_id) { | 737 bool QuicStreamFactory::ZeroRTTEnabledFor(const QuicServerId& quic_server_id) { |
736 return !(require_confirmation_ || CryptoConfigCacheIsEmpty(quic_server_id)); | 738 return !(require_confirmation_ || CryptoConfigCacheIsEmpty(quic_server_id)); |
737 } | 739 } |
738 | 740 |
739 base::TimeDelta QuicStreamFactory::GetTimeDelayForWaitingJob( | 741 base::TimeDelta QuicStreamFactory::GetTimeDelayForWaitingJob( |
740 const QuicServerId& server_id) { | 742 const QuicServerId& server_id) { |
741 if (require_confirmation_) | 743 if (!delay_tcp_race_ || require_confirmation_) |
742 return base::TimeDelta(); | 744 return base::TimeDelta(); |
743 int64_t srtt = | 745 int64_t srtt = |
744 1.5 * GetServerNetworkStatsSmoothedRttInMicroseconds(server_id); | 746 1.5 * GetServerNetworkStatsSmoothedRttInMicroseconds(server_id); |
745 // Picked 300ms based on mean time from | 747 // Picked 300ms based on mean time from |
746 // Net.QuicSession.HostResolution.HandshakeConfirmedTime histogram. | 748 // Net.QuicSession.HostResolution.HandshakeConfirmedTime histogram. |
747 const int kDefaultRTT = 300 * kNumMicrosPerMilli; | 749 const int kDefaultRTT = 300 * kNumMicrosPerMilli; |
748 if (!srtt) | 750 if (!srtt) |
749 srtt = kDefaultRTT; | 751 srtt = kDefaultRTT; |
750 return base::TimeDelta::FromMicroseconds(srtt); | 752 return base::TimeDelta::FromMicroseconds(srtt); |
751 } | 753 } |
(...skipping 1012 matching lines...) Loading... |
1764 // Since the session was active, there's no longer an | 1766 // Since the session was active, there's no longer an |
1765 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1767 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
1766 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1768 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
1767 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1769 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1768 // still race. | 1770 // still race. |
1769 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1771 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1770 alternative_service); | 1772 alternative_service); |
1771 } | 1773 } |
1772 | 1774 |
1773 } // namespace net | 1775 } // namespace net |
OLD | NEW |