diff options
author | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-21 06:50:53 +0000 |
---|---|---|
committer | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-21 06:50:53 +0000 |
commit | 10821128cb8b272856d1df04fdf102f1dda1b3f2 (patch) | |
tree | 1c6fc06244c0f77dccd0317749372bf7b78e93ce /net/websockets/websocket_throttle_unittest.cc | |
parent | 13fd6d127b9455f21cc045af9f2f65bf7bca0257 (diff) | |
download | chromium_src-10821128cb8b272856d1df04fdf102f1dda1b3f2.zip chromium_src-10821128cb8b272856d1df04fdf102f1dda1b3f2.tar.gz chromium_src-10821128cb8b272856d1df04fdf102f1dda1b3f2.tar.bz2 |
Don't process the same address for websocket throttling.
Host resolver might return address list that contains the same address twice or more. In this case, we should not process the address for websocket throttling multiple times.
If we don't have duplicate check of address, it would put the job throttle by the job itself (deadlock).
I think this is cause of failure in Linux perf (webkit.org) bot and websocket fail to connect localhost on ubuntu (crbug.com/36652)
BUG=36652,41319,40995
TEST=none
Review URL: http://codereview.chromium.org/1750001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45156 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/websockets/websocket_throttle_unittest.cc')
-rw-r--r-- | net/websockets/websocket_throttle_unittest.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/net/websockets/websocket_throttle_unittest.cc b/net/websockets/websocket_throttle_unittest.cc index 91d588f..6c0dfbb 100644 --- a/net/websockets/websocket_throttle_unittest.cc +++ b/net/websockets/websocket_throttle_unittest.cc @@ -279,4 +279,29 @@ TEST_F(WebSocketThrottleTest, Throttle) { MessageLoopForIO::current()->RunAllPending(); } +TEST_F(WebSocketThrottleTest, NoThrottleForDuplicateAddress) { + DummySocketStreamDelegate delegate; + + // For localhost: 127.0.0.1, 127.0.0.1 + struct addrinfo* addr = AddAddr(127, 0, 0, 1, NULL); + addr = AddAddr(127, 0, 0, 1, addr); + scoped_refptr<WebSocketJob> w1 = new WebSocketJob(&delegate); + scoped_refptr<SocketStream> s1 = + new SocketStream(GURL("ws://localhost/"), w1.get()); + w1->InitSocketStream(s1.get()); + WebSocketThrottleTest::MockSocketStreamConnect(s1, addr); + DeleteAddrInfo(addr); + + DLOG(INFO) << "socket1"; + TestCompletionCallback callback_s1; + // Trying to open connection to localhost will start without wait. + EXPECT_EQ(OK, w1->OnStartOpenConnection(s1, &callback_s1)); + + DLOG(INFO) << "socket1 close"; + w1->OnClose(s1.get()); + s1->DetachDelegate(); + DLOG(INFO) << "Done"; + MessageLoopForIO::current()->RunAllPending(); +} + } |