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 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 HistogramCreateSessionFailure(CREATION_ERROR_CONNECTING_SOCKET); | 1700 HistogramCreateSessionFailure(CREATION_ERROR_CONNECTING_SOCKET); |
1699 return rv; | 1701 return rv; |
1700 } | 1702 } |
1701 | 1703 |
1702 rv = socket->SetReceiveBufferSize(socket_receive_buffer_size_); | 1704 rv = socket->SetReceiveBufferSize(socket_receive_buffer_size_); |
1703 if (rv != OK) { | 1705 if (rv != OK) { |
1704 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); | 1706 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER); |
1705 return rv; | 1707 return rv; |
1706 } | 1708 } |
1707 | 1709 |
1708 rv = socket->SetDoNotFragment(); | 1710 if (quic_do_not_fragment_) { |
1709 // SetDoNotFragment is not implemented on all platforms, so ignore errors. | 1711 rv = socket->SetDoNotFragment(); |
1710 if (rv != OK && rv != ERR_NOT_IMPLEMENTED) { | 1712 // SetDoNotFragment is not implemented on all platforms, so ignore errors. |
1711 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_DO_NOT_FRAGMENT); | 1713 if (rv != OK && rv != ERR_NOT_IMPLEMENTED) { |
1712 return rv; | 1714 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_DO_NOT_FRAGMENT); |
| 1715 return rv; |
| 1716 } |
1713 } | 1717 } |
1714 | 1718 |
1715 // Set a buffer large enough to contain the initial CWND's worth of packet | 1719 // Set a buffer large enough to contain the initial CWND's worth of packet |
1716 // to work around the problem with CHLO packets being sent out with the | 1720 // to work around the problem with CHLO packets being sent out with the |
1717 // wrong encryption level, when the send buffer is full. | 1721 // wrong encryption level, when the send buffer is full. |
1718 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); | 1722 rv = socket->SetSendBufferSize(kMaxPacketSize * 20); |
1719 if (rv != OK) { | 1723 if (rv != OK) { |
1720 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); | 1724 HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER); |
1721 return rv; | 1725 return rv; |
1722 } | 1726 } |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 // Since the session was active, there's no longer an | 2031 // Since the session was active, there's no longer an |
2028 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 2032 // 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 | 2033 // 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 | 2034 // it as recently broken, which means that 0-RTT will be disabled but we'll |
2031 // still race. | 2035 // still race. |
2032 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 2036 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
2033 alternative_service); | 2037 alternative_service); |
2034 } | 2038 } |
2035 | 2039 |
2036 } // namespace net | 2040 } // namespace net |
OLD | NEW |