diff options
author | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-19 21:58:04 +0000 |
---|---|---|
committer | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-19 21:58:04 +0000 |
commit | 46da33beb42f48672659fed469da4b15ed927776 (patch) | |
tree | fb5b8aa70035f58d722ef1211da817b3f5365b00 /net/socket | |
parent | b0a7510c48c807338edf5ffa376d914e09adbf81 (diff) | |
download | chromium_src-46da33beb42f48672659fed469da4b15ed927776.zip chromium_src-46da33beb42f48672659fed469da4b15ed927776.tar.gz chromium_src-46da33beb42f48672659fed469da4b15ed927776.tar.bz2 |
Changed SPDY's ip connection pooling logic to only add the used IP,
rather than all the IPs for the hostname, to the SpdyAliasMap.
This is to fix the following problem:
When we establish a new SPDY connection, we add all IP addresses for
that hostname to our alias map. Therefore, if we connect to host foo
which maps to IPs X, Y, and Z, but the actual IP we connect to is X,
then if we try to get a SPDY connection to host bar which maps to
IPs Y and Z, then currently we will share the SPDY connection to host
foo on IP X.
BUG=89094
R=willchan
TEST=spdy unit tests
Review URL: http://codereview.chromium.org/7349023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93105 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket')
-rw-r--r-- | net/socket/ssl_client_socket_pool_unittest.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/net/socket/ssl_client_socket_pool_unittest.cc b/net/socket/ssl_client_socket_pool_unittest.cc index d04ddef..9df1376 100644 --- a/net/socket/ssl_client_socket_pool_unittest.cc +++ b/net/socket/ssl_client_socket_pool_unittest.cc @@ -14,6 +14,7 @@ #include "net/base/mock_host_resolver.h" #include "net/base/net_errors.h" #include "net/base/ssl_config_service_defaults.h" +#include "net/base/sys_addrinfo.h" #include "net/base/test_certificate_data.h" #include "net/base/test_completion_callback.h" #include "net/http/http_auth_handler_factory.h" @@ -26,6 +27,7 @@ #include "net/socket/socket_test_util.h" #include "net/spdy/spdy_session.h" #include "net/spdy/spdy_session_pool.h" +#include "net/spdy/spdy_test_util.h" #include "testing/gtest/include/gtest/gtest.h" namespace net { @@ -655,10 +657,11 @@ TEST_F(SSLClientSocketPoolTest, IPPooling) { std::string name; std::string iplist; HostPortProxyPair pair; + AddressList addresses; } test_hosts[] = { - { "www.webkit.org", "192.168.0.1,192.168.0.5" }, + { "www.webkit.org", "192.0.2.33,192.168.0.1,192.168.0.5" }, { "code.google.com", "192.168.0.2,192.168.0.3,192.168.0.5" }, - { "js.webkit.org", "192.168.0.4,192.168.0.5" }, + { "js.webkit.org", "192.168.0.4,192.168.0.1,192.0.2.33" }, }; host_resolver_.set_synchronous_mode(true); @@ -669,8 +672,8 @@ TEST_F(SSLClientSocketPoolTest, IPPooling) { // This test requires that the HostResolver cache be populated. Normal // code would have done this already, but we do it manually. HostResolver::RequestInfo info(HostPortPair(test_hosts[i].name, kTestPort)); - AddressList result; - host_resolver_.Resolve(info, &result, NULL, NULL, BoundNetLog()); + host_resolver_.Resolve(info, &test_hosts[i].addresses, NULL, NULL, + BoundNetLog()); // Setup a HostPortProxyPair test_hosts[i].pair = HostPortProxyPair( @@ -712,6 +715,12 @@ TEST_F(SSLClientSocketPoolTest, IPPooling) { EXPECT_EQ(SSLClientSocket::NextProtoFromString(proto), SSLClientSocket::kProtoSPDY2); + // TODO(rtenneti): MockClientSocket::GetPeerAddress return's 0 as the port + // number. Fix it to return port 80 and then use GetPeerAddress to AddAlias. + const addrinfo* address = test_hosts[0].addresses.head(); + SpdySessionPoolPeer pool_peer(session_->spdy_session_pool()); + pool_peer.AddAlias(address, test_hosts[0].pair); + scoped_refptr<SpdySession> spdy_session; rv = session_->spdy_session_pool()->GetSpdySessionFromSocket( test_hosts[0].pair, handle.release(), BoundNetLog(), 0, |