| 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/chromium/quic_stream_factory.h" | 5 #include "net/quic/chromium/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include <openssl/aead.h> | 7 #include <openssl/aead.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 float packet_loss_threshold, | 730 float packet_loss_threshold, |
| 731 int max_disabled_reasons, | 731 int max_disabled_reasons, |
| 732 int threshold_public_resets_post_handshake, | 732 int threshold_public_resets_post_handshake, |
| 733 int threshold_timeouts_with_open_streams, | 733 int threshold_timeouts_with_open_streams, |
| 734 int socket_receive_buffer_size, | 734 int socket_receive_buffer_size, |
| 735 bool delay_tcp_race, | 735 bool delay_tcp_race, |
| 736 int max_server_configs_stored_in_properties, | 736 int max_server_configs_stored_in_properties, |
| 737 bool close_sessions_on_ip_change, | 737 bool close_sessions_on_ip_change, |
| 738 bool disable_quic_on_timeout_with_open_streams, | 738 bool disable_quic_on_timeout_with_open_streams, |
| 739 int idle_connection_timeout_seconds, | 739 int idle_connection_timeout_seconds, |
| 740 int reduced_ping_timeout_seconds, |
| 740 int packet_reader_yield_after_duration_milliseconds, | 741 int packet_reader_yield_after_duration_milliseconds, |
| 741 bool migrate_sessions_on_network_change, | 742 bool migrate_sessions_on_network_change, |
| 742 bool migrate_sessions_early, | 743 bool migrate_sessions_early, |
| 743 bool allow_server_migration, | 744 bool allow_server_migration, |
| 744 bool force_hol_blocking, | 745 bool force_hol_blocking, |
| 745 bool race_cert_verification, | 746 bool race_cert_verification, |
| 746 const QuicTagVector& connection_options, | 747 const QuicTagVector& connection_options, |
| 747 bool enable_token_binding) | 748 bool enable_token_binding) |
| 748 : require_confirmation_(true), | 749 : require_confirmation_(true), |
| 749 net_log_(net_log), | 750 net_log_(net_log), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 num_public_resets_post_handshake_(0), | 782 num_public_resets_post_handshake_(0), |
| 782 num_timeouts_with_open_streams_(0), | 783 num_timeouts_with_open_streams_(0), |
| 783 max_public_resets_post_handshake_(0), | 784 max_public_resets_post_handshake_(0), |
| 784 max_timeouts_with_open_streams_(0), | 785 max_timeouts_with_open_streams_(0), |
| 785 threshold_timeouts_with_open_streams_( | 786 threshold_timeouts_with_open_streams_( |
| 786 threshold_timeouts_with_open_streams), | 787 threshold_timeouts_with_open_streams), |
| 787 threshold_public_resets_post_handshake_( | 788 threshold_public_resets_post_handshake_( |
| 788 threshold_public_resets_post_handshake), | 789 threshold_public_resets_post_handshake), |
| 789 socket_receive_buffer_size_(socket_receive_buffer_size), | 790 socket_receive_buffer_size_(socket_receive_buffer_size), |
| 790 delay_tcp_race_(delay_tcp_race), | 791 delay_tcp_race_(delay_tcp_race), |
| 792 ping_timeout_seconds_(kPingTimeoutSecs), |
| 793 reduced_ping_timeout_seconds_(reduced_ping_timeout_seconds), |
| 791 yield_after_packets_(kQuicYieldAfterPacketsRead), | 794 yield_after_packets_(kQuicYieldAfterPacketsRead), |
| 792 yield_after_duration_(QuicTime::Delta::FromMilliseconds( | 795 yield_after_duration_(QuicTime::Delta::FromMilliseconds( |
| 793 packet_reader_yield_after_duration_milliseconds)), | 796 packet_reader_yield_after_duration_milliseconds)), |
| 794 close_sessions_on_ip_change_(close_sessions_on_ip_change), | 797 close_sessions_on_ip_change_(close_sessions_on_ip_change), |
| 795 migrate_sessions_on_network_change_( | 798 migrate_sessions_on_network_change_( |
| 796 migrate_sessions_on_network_change && | 799 migrate_sessions_on_network_change && |
| 797 NetworkChangeNotifier::AreNetworkHandlesSupported()), | 800 NetworkChangeNotifier::AreNetworkHandlesSupported()), |
| 798 migrate_sessions_early_(migrate_sessions_early && | 801 migrate_sessions_early_(migrate_sessions_early && |
| 799 migrate_sessions_on_network_change_), | 802 migrate_sessions_on_network_change_), |
| 800 allow_server_migration_(allow_server_migration), | 803 allow_server_migration_(allow_server_migration), |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1785 alarm_factory_.reset(new QuicChromiumAlarmFactory( | 1788 alarm_factory_.reset(new QuicChromiumAlarmFactory( |
| 1786 base::ThreadTaskRunnerHandle::Get().get(), clock_.get())); | 1789 base::ThreadTaskRunnerHandle::Get().get(), clock_.get())); |
| 1787 } | 1790 } |
| 1788 QuicConnectionId connection_id = random_generator_->RandUint64(); | 1791 QuicConnectionId connection_id = random_generator_->RandUint64(); |
| 1789 InitializeCachedStateInCryptoConfig(server_id, server_info, &connection_id); | 1792 InitializeCachedStateInCryptoConfig(server_id, server_info, &connection_id); |
| 1790 | 1793 |
| 1791 QuicChromiumPacketWriter* writer = new QuicChromiumPacketWriter(socket.get()); | 1794 QuicChromiumPacketWriter* writer = new QuicChromiumPacketWriter(socket.get()); |
| 1792 QuicConnection* connection = new QuicConnection( | 1795 QuicConnection* connection = new QuicConnection( |
| 1793 connection_id, addr, helper_.get(), alarm_factory_.get(), writer, | 1796 connection_id, addr, helper_.get(), alarm_factory_.get(), writer, |
| 1794 true /* owns_writer */, Perspective::IS_CLIENT, supported_versions_); | 1797 true /* owns_writer */, Perspective::IS_CLIENT, supported_versions_); |
| 1798 if (ping_timeout_seconds_ != kPingTimeoutSecs) { |
| 1799 connection->set_ping_timeout(ping_timeout_seconds_); |
| 1800 } |
| 1795 connection->SetMaxPacketLength(max_packet_length_); | 1801 connection->SetMaxPacketLength(max_packet_length_); |
| 1796 | 1802 |
| 1797 QuicConfig config = config_; | 1803 QuicConfig config = config_; |
| 1798 config.SetSocketReceiveBufferToSend(socket_receive_buffer_size_); | 1804 config.SetSocketReceiveBufferToSend(socket_receive_buffer_size_); |
| 1799 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); | 1805 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); |
| 1800 config.SetInitialSessionFlowControlWindowToSend( | 1806 config.SetInitialSessionFlowControlWindowToSend( |
| 1801 kQuicSessionMaxRecvWindowSize); | 1807 kQuicSessionMaxRecvWindowSize); |
| 1802 config.SetInitialStreamFlowControlWindowToSend(kQuicStreamMaxRecvWindowSize); | 1808 config.SetInitialStreamFlowControlWindowToSend(kQuicStreamMaxRecvWindowSize); |
| 1803 int64_t srtt = GetServerNetworkStatsSmoothedRttInMicroseconds(server_id); | 1809 int64_t srtt = GetServerNetworkStatsSmoothedRttInMicroseconds(server_id); |
| 1804 if (srtt > 0) | 1810 if (srtt > 0) |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2027 // Since the session was active, there's no longer an | 2033 // Since the session was active, there's no longer an |
| 2028 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 2034 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 2029 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 2035 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 2030 // it as recently broken, which means that 0-RTT will be disabled but we'll | 2036 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 2031 // still race. | 2037 // still race. |
| 2032 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 2038 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 2033 alternative_service); | 2039 alternative_service); |
| 2034 } | 2040 } |
| 2035 | 2041 |
| 2036 } // namespace net | 2042 } // namespace net |
| OLD | NEW |