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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 NetLog::TYPE_SPDY_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, | 163 NetLog::TYPE_SPDY_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, |
164 make_scoped_refptr(new NetLogSourceParameter( | 164 make_scoped_refptr(new NetLogSourceParameter( |
165 "source_dependency", (*spdy_session)->net_log().source()))); | 165 "source_dependency", (*spdy_session)->net_log().source()))); |
166 | 166 |
167 // We have a new session. Lookup the IP address for this session so that we | 167 // We have a new session. Lookup the IP address for this session so that we |
168 // can match future Sessions (potentially to different domains) which can | 168 // can match future Sessions (potentially to different domains) which can |
169 // potentially be pooled with this one. Because GetPeerAddress() reports the | 169 // potentially be pooled with this one. Because GetPeerAddress() reports the |
170 // proxy's address instead of the origin server, check to see if this is a | 170 // proxy's address instead of the origin server, check to see if this is a |
171 // direct connection. | 171 // direct connection. |
172 if (g_enable_ip_pooling && host_port_proxy_pair.second.is_direct()) { | 172 if (g_enable_ip_pooling && host_port_proxy_pair.second.is_direct()) { |
173 AddressList addresses; | 173 IPEndPoint address; |
174 if (connection->socket()->GetPeerAddress(&addresses) == OK) | 174 if (connection->socket()->GetPeerAddress(&address) == OK) |
175 AddAlias(addresses.front(), host_port_proxy_pair); | 175 AddAlias(address, host_port_proxy_pair); |
176 } | 176 } |
177 | 177 |
178 // Now we can initialize the session with the SSL socket. | 178 // Now we can initialize the session with the SSL socket. |
179 return (*spdy_session)->InitializeWithSocket(connection, is_secure, | 179 return (*spdy_session)->InitializeWithSocket(connection, is_secure, |
180 certificate_error_code); | 180 certificate_error_code); |
181 } | 181 } |
182 | 182 |
183 bool SpdySessionPool::HasSession( | 183 bool SpdySessionPool::HasSession( |
184 const HostPortProxyPair& host_port_proxy_pair) const { | 184 const HostPortProxyPair& host_port_proxy_pair) const { |
185 if (GetSessionList(host_port_proxy_pair)) | 185 if (GetSessionList(host_port_proxy_pair)) |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 const scoped_refptr<SpdySession>& session = *session_it; | 453 const scoped_refptr<SpdySession>& session = *session_it; |
454 CHECK(session); | 454 CHECK(session); |
455 if (!session->is_active()) { | 455 if (!session->is_active()) { |
456 session->CloseSessionOnError( | 456 session->CloseSessionOnError( |
457 net::ERR_ABORTED, true, "Closing idle sessions."); | 457 net::ERR_ABORTED, true, "Closing idle sessions."); |
458 } | 458 } |
459 } | 459 } |
460 } | 460 } |
461 | 461 |
462 } // namespace net | 462 } // namespace net |
OLD | NEW |