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