Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: net/spdy/spdy_session_pool.cc

Issue 10309002: Reimplements net::AddressList without struct addrinfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get_canonical_name -> canonical_name. iterator to indexing Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_session_pool.h ('k') | net/spdy/spdy_session_spdy2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session_pool.cc
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index 430a2338d82b603f7d75908064ebfd935b45c182..7fc617ec802362979854c88c55d25147e569a946 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -8,7 +8,6 @@
#include "base/metrics/histogram.h"
#include "base/values.h"
#include "net/base/address_list.h"
-#include "net/base/sys_addrinfo.h"
#include "net/http/http_network_session.h"
#include "net/http/http_server_properties.h"
#include "net/spdy/spdy_session.h"
@@ -173,7 +172,7 @@ net::Error SpdySessionPool::GetSpdySessionFromSocket(
if (g_enable_ip_pooling && host_port_proxy_pair.second.is_direct()) {
AddressList addresses;
if (connection->socket()->GetPeerAddress(&addresses) == OK)
- AddAlias(addresses.head(), host_port_proxy_pair);
+ AddAlias(addresses.front(), host_port_proxy_pair);
}
// Now we can initialize the session with the SSL socket.
@@ -275,18 +274,15 @@ scoped_refptr<SpdySession> SpdySessionPool::GetFromAlias(
AddressList addresses;
if (!LookupAddresses(host_port_proxy_pair, net_log, &addresses))
return NULL;
- const addrinfo* address = addresses.head();
- while (address) {
- IPEndPoint endpoint;
- endpoint.FromSockAddr(address->ai_addr, address->ai_addrlen);
- address = address->ai_next;
-
- SpdyAliasMap::const_iterator it = aliases_.find(endpoint);
- if (it == aliases_.end())
+ for (AddressList::const_iterator iter = addresses.begin();
+ iter != addresses.end();
+ ++iter) {
+ SpdyAliasMap::const_iterator alias_iter = aliases_.find(*iter);
+ if (alias_iter == aliases_.end())
continue;
// We found an alias.
- const HostPortProxyPair& alias_pair = it->second;
+ const HostPortProxyPair& alias_pair = alias_iter->second;
// If the proxy settings match, we can reuse this session.
if (!(alias_pair.second == host_port_proxy_pair.second))
@@ -382,12 +378,9 @@ bool SpdySessionPool::LookupAddresses(const HostPortProxyPair& pair,
return rv == OK;
}
-void SpdySessionPool::AddAlias(const addrinfo* address,
+void SpdySessionPool::AddAlias(const IPEndPoint& endpoint,
const HostPortProxyPair& pair) {
DCHECK(g_enable_ip_pooling);
- DCHECK(address);
- IPEndPoint endpoint;
- endpoint.FromSockAddr(address->ai_addr, address->ai_addrlen);
aliases_[endpoint] = pair;
}
« no previous file with comments | « net/spdy/spdy_session_pool.h ('k') | net/spdy/spdy_session_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698