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/spdy/spdy_session_pool.h" | 5 #include "net/spdy/spdy_session_pool.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 SPDY_SESSION_GET_MAX = 4 | 25 SPDY_SESSION_GET_MAX = 4 |
26 }; | 26 }; |
27 | 27 |
28 } // namespace | 28 } // namespace |
29 | 29 |
30 SpdySessionPool::SpdySessionPool( | 30 SpdySessionPool::SpdySessionPool( |
31 HostResolver* resolver, | 31 HostResolver* resolver, |
32 SSLConfigService* ssl_config_service, | 32 SSLConfigService* ssl_config_service, |
33 const base::WeakPtr<HttpServerProperties>& http_server_properties, | 33 const base::WeakPtr<HttpServerProperties>& http_server_properties, |
34 bool force_single_domain, | 34 bool force_single_domain, |
35 bool enable_ip_pooling, | |
36 bool enable_compression, | 35 bool enable_compression, |
37 bool enable_ping_based_connection_checking, | 36 bool enable_ping_based_connection_checking, |
38 NextProto default_protocol, | 37 NextProto default_protocol, |
39 size_t stream_initial_recv_window_size, | 38 size_t stream_initial_recv_window_size, |
40 size_t initial_max_concurrent_streams, | 39 size_t initial_max_concurrent_streams, |
41 size_t max_concurrent_streams_limit, | 40 size_t max_concurrent_streams_limit, |
42 SpdySessionPool::TimeFunc time_func, | 41 SpdySessionPool::TimeFunc time_func, |
43 const std::string& trusted_spdy_proxy) | 42 const std::string& trusted_spdy_proxy) |
44 : http_server_properties_(http_server_properties), | 43 : http_server_properties_(http_server_properties), |
45 ssl_config_service_(ssl_config_service), | 44 ssl_config_service_(ssl_config_service), |
46 resolver_(resolver), | 45 resolver_(resolver), |
47 verify_domain_authentication_(true), | 46 verify_domain_authentication_(true), |
48 enable_sending_initial_data_(true), | 47 enable_sending_initial_data_(true), |
49 force_single_domain_(force_single_domain), | 48 force_single_domain_(force_single_domain), |
50 enable_ip_pooling_(enable_ip_pooling), | |
51 enable_compression_(enable_compression), | 49 enable_compression_(enable_compression), |
52 enable_ping_based_connection_checking_( | 50 enable_ping_based_connection_checking_( |
53 enable_ping_based_connection_checking), | 51 enable_ping_based_connection_checking), |
54 // TODO(akalin): Force callers to have a valid value of | 52 // TODO(akalin): Force callers to have a valid value of |
55 // |default_protocol_|. | 53 // |default_protocol_|. |
56 default_protocol_( | 54 default_protocol_( |
57 (default_protocol == kProtoUnknown) ? | 55 (default_protocol == kProtoUnknown) ? |
58 kProtoSPDY3 : default_protocol), | 56 kProtoSPDY3 : default_protocol), |
59 stream_initial_recv_window_size_(stream_initial_recv_window_size), | 57 stream_initial_recv_window_size_(stream_initial_recv_window_size), |
60 initial_max_concurrent_streams_(initial_max_concurrent_streams), | 58 initial_max_concurrent_streams_(initial_max_concurrent_streams), |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 120 |
123 net_log.AddEvent( | 121 net_log.AddEvent( |
124 NetLog::TYPE_SPDY_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, | 122 NetLog::TYPE_SPDY_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, |
125 (*available_session)->net_log().source().ToEventParametersCallback()); | 123 (*available_session)->net_log().source().ToEventParametersCallback()); |
126 | 124 |
127 // Look up the IP address for this session so that we can match | 125 // Look up the IP address for this session so that we can match |
128 // future sessions (potentially to different domains) which can | 126 // future sessions (potentially to different domains) which can |
129 // potentially be pooled with this one. Because GetPeerAddress() | 127 // potentially be pooled with this one. Because GetPeerAddress() |
130 // reports the proxy's address instead of the origin server, check | 128 // reports the proxy's address instead of the origin server, check |
131 // to see if this is a direct connection. | 129 // to see if this is a direct connection. |
132 if (enable_ip_pooling_ && key.proxy_server().is_direct()) { | 130 if (key.proxy_server().is_direct()) { |
133 IPEndPoint address; | 131 IPEndPoint address; |
134 if ((*available_session)->GetPeerAddress(&address) == OK) | 132 if ((*available_session)->GetPeerAddress(&address) == OK) |
135 aliases_[address] = key; | 133 aliases_[address] = key; |
136 } | 134 } |
137 | 135 |
138 return error; | 136 return error; |
139 } | 137 } |
140 | 138 |
141 base::WeakPtr<SpdySession> SpdySessionPool::FindAvailableSession( | 139 base::WeakPtr<SpdySession> SpdySessionPool::FindAvailableSession( |
142 const SpdySessionKey& key, | 140 const SpdySessionKey& key, |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 if (idle_only && (*it)->is_active()) | 397 if (idle_only && (*it)->is_active()) |
400 continue; | 398 continue; |
401 | 399 |
402 (*it)->CloseSessionOnError(error, description); | 400 (*it)->CloseSessionOnError(error, description); |
403 DCHECK(!IsSessionAvailable(*it)); | 401 DCHECK(!IsSessionAvailable(*it)); |
404 DCHECK(!*it); | 402 DCHECK(!*it); |
405 } | 403 } |
406 } | 404 } |
407 | 405 |
408 } // namespace net | 406 } // namespace net |
OLD | NEW |