OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 make_scoped_refptr(new NetLogSourceParameter( | 150 make_scoped_refptr(new NetLogSourceParameter( |
151 "session", (*spdy_session)->net_log().source()))); | 151 "session", (*spdy_session)->net_log().source()))); |
152 | 152 |
153 // We have a new session. Lookup the IP address for this session so that we | 153 // We have a new session. Lookup the IP address for this session so that we |
154 // can match future Sessions (potentially to different domains) which can | 154 // can match future Sessions (potentially to different domains) which can |
155 // potentially be pooled with this one. Because GetPeerAddress() reports the | 155 // potentially be pooled with this one. Because GetPeerAddress() reports the |
156 // proxy's address instead of the origin server, check to see if this is a | 156 // proxy's address instead of the origin server, check to see if this is a |
157 // direct connection. | 157 // direct connection. |
158 if (g_enable_ip_pooling && host_port_proxy_pair.second.is_direct()) { | 158 if (g_enable_ip_pooling && host_port_proxy_pair.second.is_direct()) { |
159 AddressList addresses; | 159 AddressList addresses; |
160 if (connection->socket()->GetPeerAddress(&addresses) == OK) { | 160 if (connection->socket()->GetPeerAddress(&addresses) == OK) |
161 const addrinfo* address = addresses.head(); | 161 AddAlias(addresses.head(), host_port_proxy_pair); |
162 AddAlias(address, host_port_proxy_pair); | |
163 } | |
164 } | 162 } |
165 | 163 |
166 // Now we can initialize the session with the SSL socket. | 164 // Now we can initialize the session with the SSL socket. |
167 return (*spdy_session)->InitializeWithSocket(connection, is_secure, | 165 return (*spdy_session)->InitializeWithSocket(connection, is_secure, |
168 certificate_error_code); | 166 certificate_error_code); |
169 } | 167 } |
170 | 168 |
171 bool SpdySessionPool::HasSession( | 169 bool SpdySessionPool::HasSession( |
172 const HostPortProxyPair& host_port_proxy_pair) const { | 170 const HostPortProxyPair& host_port_proxy_pair) const { |
173 if (GetSessionList(host_port_proxy_pair)) | 171 if (GetSessionList(host_port_proxy_pair)) |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 delete list; | 410 delete list; |
413 RemoveAliases(old_map.begin()->first); | 411 RemoveAliases(old_map.begin()->first); |
414 old_map.erase(old_map.begin()->first); | 412 old_map.erase(old_map.begin()->first); |
415 } | 413 } |
416 } | 414 } |
417 DCHECK(sessions_.empty()); | 415 DCHECK(sessions_.empty()); |
418 DCHECK(aliases_.empty()); | 416 DCHECK(aliases_.empty()); |
419 } | 417 } |
420 | 418 |
421 } // namespace net | 419 } // namespace net |
OLD | NEW |