| 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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 packet_reader_yield_after_duration_milliseconds, | 740 int packet_reader_yield_after_duration_milliseconds, |
| 741 bool migrate_sessions_on_network_change, | 741 bool migrate_sessions_on_network_change, |
| 742 bool migrate_sessions_early, | 742 bool migrate_sessions_early, |
| 743 bool allow_server_migration, | 743 bool allow_server_migration, |
| 744 bool force_hol_blocking, | 744 bool force_hol_blocking, |
| 745 bool race_cert_verification, | 745 bool race_cert_verification, |
| 746 bool quic_do_not_fragment, |
| 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), |
| 750 host_resolver_(host_resolver), | 751 host_resolver_(host_resolver), |
| 751 client_socket_factory_(client_socket_factory), | 752 client_socket_factory_(client_socket_factory), |
| 752 http_server_properties_(http_server_properties), | 753 http_server_properties_(http_server_properties), |
| 753 transport_security_state_(transport_security_state), | 754 transport_security_state_(transport_security_state), |
| 754 cert_transparency_verifier_(cert_transparency_verifier), | 755 cert_transparency_verifier_(cert_transparency_verifier), |
| 755 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 756 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 packet_reader_yield_after_duration_milliseconds)), | 794 packet_reader_yield_after_duration_milliseconds)), |
| 794 close_sessions_on_ip_change_(close_sessions_on_ip_change), | 795 close_sessions_on_ip_change_(close_sessions_on_ip_change), |
| 795 migrate_sessions_on_network_change_( | 796 migrate_sessions_on_network_change_( |
| 796 migrate_sessions_on_network_change && | 797 migrate_sessions_on_network_change && |
| 797 NetworkChangeNotifier::AreNetworkHandlesSupported()), | 798 NetworkChangeNotifier::AreNetworkHandlesSupported()), |
| 798 migrate_sessions_early_(migrate_sessions_early && | 799 migrate_sessions_early_(migrate_sessions_early && |
| 799 migrate_sessions_on_network_change_), | 800 migrate_sessions_on_network_change_), |
| 800 allow_server_migration_(allow_server_migration), | 801 allow_server_migration_(allow_server_migration), |
| 801 force_hol_blocking_(force_hol_blocking), | 802 force_hol_blocking_(force_hol_blocking), |
| 802 race_cert_verification_(race_cert_verification), | 803 race_cert_verification_(race_cert_verification), |
| 804 quic_do_not_fragment_(quic_do_not_fragment), |
| 803 port_seed_(random_generator_->RandUint64()), | 805 port_seed_(random_generator_->RandUint64()), |
| 804 check_persisted_supports_quic_(true), | 806 check_persisted_supports_quic_(true), |
| 805 has_initialized_data_(false), | 807 has_initialized_data_(false), |
| 806 num_push_streams_created_(0), | 808 num_push_streams_created_(0), |
| 807 status_(OPEN), | 809 status_(OPEN), |
| 808 task_runner_(nullptr), | 810 task_runner_(nullptr), |
| 809 ssl_config_service_(ssl_config_service), | 811 ssl_config_service_(ssl_config_service), |
| 810 weak_factory_(this) { | 812 weak_factory_(this) { |
| 811 if (ssl_config_service_.get()) | 813 if (ssl_config_service_.get()) |
| 812 ssl_config_service_->AddObserver(this); | 814 ssl_config_service_->AddObserver(this); |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 HistogramCreateSessionFailure(CREATION_ERROR_CONNECTING_SOCKET); | 1698 HistogramCreateSessionFailure(CREATION_ERROR_CONNECTING_SOCKET); |
| 1697 return rv; | 1699 return rv; |
| 1698 } | 1700 } |
| 1699 | 1701 |
| 1700 rv = socket->SetReceiveBufferSize(socket_receive_buffer_size_); | 1702 rv = socket->SetReceiveBufferSize(socket_receive_buffer_size_); |
| 1701 if (rv != OK) { | 1703 if (rv != OK) { |
| 1702 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); | 1704 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); |
| 1703 return rv; | 1705 return rv; |
| 1704 } | 1706 } |
| 1705 | 1707 |
| 1706 rv = socket->SetDoNotFragment(); | 1708 if (quic_do_not_fragment_) { |
| 1707 // SetDoNotFragment is not implemented on all platforms, so ignore errors. | 1709 rv = socket->SetDoNotFragment(); |
| 1708 if (rv != OK && rv != ERR_NOT_IMPLEMENTED) { | 1710 // SetDoNotFragment is not implemented on all platforms, so ignore errors. |
| 1709 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_DO_NOT_FRAGMENT); | 1711 if (rv != OK && rv != ERR_NOT_IMPLEMENTED) { |
| 1710 return rv; | 1712 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_DO_NOT_FRAGMENT); |
| 1713 return rv; |
| 1714 } |
| 1711 } | 1715 } |
| 1712 | 1716 |
| 1713 // Set a buffer large enough to contain the initial CWND's worth of packet | 1717 // Set a buffer large enough to contain the initial CWND's worth of packet |
| 1714 // to work around the problem with CHLO packets being sent out with the | 1718 // to work around the problem with CHLO packets being sent out with the |
| 1715 // wrong encryption level, when the send buffer is full. | 1719 // wrong encryption level, when the send buffer is full. |
| 1716 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); | 1720 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); |
| 1717 if (rv != OK) { | 1721 if (rv != OK) { |
| 1718 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); | 1722 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); |
| 1719 return rv; | 1723 return rv; |
| 1720 } | 1724 } |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 // Since the session was active, there's no longer an | 2027 // Since the session was active, there's no longer an |
| 2024 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 2028 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 2025 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 2029 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 2026 // it as recently broken, which means that 0-RTT will be disabled but we'll | 2030 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 2027 // still race. | 2031 // still race. |
| 2028 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 2032 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 2029 alternative_service); | 2033 alternative_service); |
| 2030 } | 2034 } |
| 2031 | 2035 |
| 2032 } // namespace net | 2036 } // namespace net |
| OLD | NEW |