| 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/http/http_network_session.h" | 5 #include "net/http/http_network_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 // The maximum receive window sizes for HTTP/2 sessions and streams. | 54 // The maximum receive window sizes for HTTP/2 sessions and streams. |
| 55 const int32 kSpdySessionMaxRecvWindowSize = 15 * 1024 * 1024; // 15 MB | 55 const int32 kSpdySessionMaxRecvWindowSize = 15 * 1024 * 1024; // 15 MB |
| 56 const int32 kSpdyStreamMaxRecvWindowSize = 6 * 1024 * 1024; // 6 MB | 56 const int32 kSpdyStreamMaxRecvWindowSize = 6 * 1024 * 1024; // 6 MB |
| 57 // QUIC's socket receive buffer size. | 57 // QUIC's socket receive buffer size. |
| 58 // We should adaptively set this buffer size, but for now, we'll use a size | 58 // We should adaptively set this buffer size, but for now, we'll use a size |
| 59 // that seems large enough to receive data at line rate for most connections, | 59 // that seems large enough to receive data at line rate for most connections, |
| 60 // and does not consume "too much" memory. | 60 // and does not consume "too much" memory. |
| 61 const int32 kQuicSocketReceiveBufferSize = 1024 * 1024; // 1MB | 61 const int32 kQuicSocketReceiveBufferSize = 1024 * 1024; // 1MB |
| 62 | 62 |
| 63 // Number of recent connections to consider for certain thresholds |
| 64 // that trigger disabling QUIC. E.g. disable QUIC if PUBLIC_RESET was |
| 65 // received post handshake for at least 2 of 20 recent connections. |
| 66 const int32 kQuicMaxRecentDisabledReasons = 20; |
| 67 |
| 63 HttpNetworkSession::Params::Params() | 68 HttpNetworkSession::Params::Params() |
| 64 : client_socket_factory(NULL), | 69 : client_socket_factory(NULL), |
| 65 host_resolver(NULL), | 70 host_resolver(NULL), |
| 66 cert_verifier(NULL), | 71 cert_verifier(NULL), |
| 67 cert_policy_enforcer(NULL), | 72 cert_policy_enforcer(NULL), |
| 68 channel_id_service(NULL), | 73 channel_id_service(NULL), |
| 69 transport_security_state(NULL), | 74 transport_security_state(NULL), |
| 70 cert_transparency_verifier(NULL), | 75 cert_transparency_verifier(NULL), |
| 71 proxy_service(NULL), | 76 proxy_service(NULL), |
| 72 ssl_config_service(NULL), | 77 ssl_config_service(NULL), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 99 quic_disable_disk_cache(false), | 104 quic_disable_disk_cache(false), |
| 100 quic_prefer_aes(false), | 105 quic_prefer_aes(false), |
| 101 quic_max_number_of_lossy_connections(0), | 106 quic_max_number_of_lossy_connections(0), |
| 102 quic_packet_loss_threshold(1.0f), | 107 quic_packet_loss_threshold(1.0f), |
| 103 quic_socket_receive_buffer_size(kQuicSocketReceiveBufferSize), | 108 quic_socket_receive_buffer_size(kQuicSocketReceiveBufferSize), |
| 104 quic_clock(NULL), | 109 quic_clock(NULL), |
| 105 quic_random(NULL), | 110 quic_random(NULL), |
| 106 quic_max_packet_length(kDefaultMaxPacketSize), | 111 quic_max_packet_length(kDefaultMaxPacketSize), |
| 107 enable_user_alternate_protocol_ports(false), | 112 enable_user_alternate_protocol_ports(false), |
| 108 quic_crypto_client_stream_factory(NULL), | 113 quic_crypto_client_stream_factory(NULL), |
| 114 quic_max_recent_disabled_reasons(kQuicMaxRecentDisabledReasons), |
| 115 quic_threshold_public_resets_post_handshake(0), |
| 116 quic_threshold_timeouts_streams_open(0), |
| 109 proxy_delegate(NULL) { | 117 proxy_delegate(NULL) { |
| 110 quic_supported_versions.push_back(QUIC_VERSION_25); | 118 quic_supported_versions.push_back(QUIC_VERSION_25); |
| 111 } | 119 } |
| 112 | 120 |
| 113 HttpNetworkSession::Params::~Params() {} | 121 HttpNetworkSession::Params::~Params() {} |
| 114 | 122 |
| 115 // TODO(mbelshe): Move the socket factories into HttpStreamFactory. | 123 // TODO(mbelshe): Move the socket factories into HttpStreamFactory. |
| 116 HttpNetworkSession::HttpNetworkSession(const Params& params) | 124 HttpNetworkSession::HttpNetworkSession(const Params& params) |
| 117 : net_log_(params.net_log), | 125 : net_log_(params.net_log), |
| 118 network_delegate_(params.network_delegate), | 126 network_delegate_(params.network_delegate), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 144 params.quic_always_require_handshake_confirmation, | 152 params.quic_always_require_handshake_confirmation, |
| 145 params.quic_disable_connection_pooling, | 153 params.quic_disable_connection_pooling, |
| 146 params.quic_load_server_info_timeout_srtt_multiplier, | 154 params.quic_load_server_info_timeout_srtt_multiplier, |
| 147 params.quic_enable_connection_racing, | 155 params.quic_enable_connection_racing, |
| 148 params.quic_enable_non_blocking_io, | 156 params.quic_enable_non_blocking_io, |
| 149 params.quic_disable_disk_cache, | 157 params.quic_disable_disk_cache, |
| 150 params.quic_prefer_aes, | 158 params.quic_prefer_aes, |
| 151 params.quic_max_number_of_lossy_connections, | 159 params.quic_max_number_of_lossy_connections, |
| 152 params.quic_packet_loss_threshold, | 160 params.quic_packet_loss_threshold, |
| 153 params.quic_socket_receive_buffer_size, | 161 params.quic_socket_receive_buffer_size, |
| 162 params.quic_max_recent_disabled_reasons, |
| 163 params.quic_threshold_public_resets_post_handshake, |
| 164 params.quic_threshold_timeouts_streams_open, |
| 154 params.quic_connection_options), | 165 params.quic_connection_options), |
| 155 spdy_session_pool_(params.host_resolver, | 166 spdy_session_pool_(params.host_resolver, |
| 156 params.ssl_config_service, | 167 params.ssl_config_service, |
| 157 params.http_server_properties, | 168 params.http_server_properties, |
| 158 params.transport_security_state, | 169 params.transport_security_state, |
| 159 params.enable_spdy_compression, | 170 params.enable_spdy_compression, |
| 160 params.enable_spdy_ping_based_connection_checking, | 171 params.enable_spdy_ping_based_connection_checking, |
| 161 params.spdy_default_protocol, | 172 params.spdy_default_protocol, |
| 162 params.spdy_session_max_recv_window_size, | 173 params.spdy_session_max_recv_window_size, |
| 163 params.spdy_stream_max_recv_window_size, | 174 params.spdy_stream_max_recv_window_size, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 for (QuicTagVector::const_iterator it = | 282 for (QuicTagVector::const_iterator it = |
| 272 params_.quic_connection_options.begin(); | 283 params_.quic_connection_options.begin(); |
| 273 it != params_.quic_connection_options.end(); ++it) { | 284 it != params_.quic_connection_options.end(); ++it) { |
| 274 connection_options->AppendString("'" + QuicUtils::TagToString(*it) + "'"); | 285 connection_options->AppendString("'" + QuicUtils::TagToString(*it) + "'"); |
| 275 } | 286 } |
| 276 dict->Set("connection_options", connection_options.Pass()); | 287 dict->Set("connection_options", connection_options.Pass()); |
| 277 dict->SetString("origin_to_force_quic_on", | 288 dict->SetString("origin_to_force_quic_on", |
| 278 params_.origin_to_force_quic_on.ToString()); | 289 params_.origin_to_force_quic_on.ToString()); |
| 279 dict->SetDouble("alternative_service_probability_threshold", | 290 dict->SetDouble("alternative_service_probability_threshold", |
| 280 params_.alternative_service_probability_threshold); | 291 params_.alternative_service_probability_threshold); |
| 292 dict->SetString("disabled_reason", |
| 293 quic_stream_factory_.QuicDisabledReasonString()); |
| 281 return dict.Pass(); | 294 return dict.Pass(); |
| 282 } | 295 } |
| 283 | 296 |
| 284 void HttpNetworkSession::CloseAllConnections() { | 297 void HttpNetworkSession::CloseAllConnections() { |
| 285 normal_socket_pool_manager_->FlushSocketPoolsWithError(ERR_ABORTED); | 298 normal_socket_pool_manager_->FlushSocketPoolsWithError(ERR_ABORTED); |
| 286 websocket_socket_pool_manager_->FlushSocketPoolsWithError(ERR_ABORTED); | 299 websocket_socket_pool_manager_->FlushSocketPoolsWithError(ERR_ABORTED); |
| 287 spdy_session_pool_.CloseCurrentSessions(ERR_ABORTED); | 300 spdy_session_pool_.CloseCurrentSessions(ERR_ABORTED); |
| 288 quic_stream_factory_.CloseAllSessions(ERR_ABORTED); | 301 quic_stream_factory_.CloseAllSessions(ERR_ABORTED); |
| 289 } | 302 } |
| 290 | 303 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 case WEBSOCKET_SOCKET_POOL: | 335 case WEBSOCKET_SOCKET_POOL: |
| 323 return websocket_socket_pool_manager_.get(); | 336 return websocket_socket_pool_manager_.get(); |
| 324 default: | 337 default: |
| 325 NOTREACHED(); | 338 NOTREACHED(); |
| 326 break; | 339 break; |
| 327 } | 340 } |
| 328 return NULL; | 341 return NULL; |
| 329 } | 342 } |
| 330 | 343 |
| 331 } // namespace net | 344 } // namespace net |
| OLD | NEW |