diff options
author | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-05 15:25:03 +0000 |
---|---|---|
committer | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-05 15:25:03 +0000 |
commit | 2390e7fb667d60a8a6fc7a1d002e24f12820ab2c (patch) | |
tree | c862184f03a3e08a49f0a699f4370b3fd668742b /chrome_frame | |
parent | 6814fce80baccfca00f55555ae08402aadc2d6ed (diff) | |
download | chromium_src-2390e7fb667d60a8a6fc7a1d002e24f12820ab2c.zip chromium_src-2390e7fb667d60a8a6fc7a1d002e24f12820ab2c.tar.gz chromium_src-2390e7fb667d60a8a6fc7a1d002e24f12820ab2c.tar.bz2 |
Close accepted server sockets early and often.
In one case, sockets weren't being closed until the listen socket was destroyed (later than optimal), and in another they weren't being closed at all process-wide.
BUG=96449
TEST=hope that chrome_frame_tests.exe --gtest_filter=ChromeFrameTestWithWebServer.* becomes less flaky.
Review URL: https://chromiumcodereview.appspot.com/10007006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130927 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/test/test_server.cc | 2 | ||||
-rw-r--r-- | chrome_frame/test/test_server.h | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/chrome_frame/test/test_server.cc b/chrome_frame/test/test_server.cc index a4875fb..db5be8d 100644 --- a/chrome_frame/test/test_server.cc +++ b/chrome_frame/test/test_server.cc @@ -153,7 +153,6 @@ void SimpleWebServer::DeleteAllResponses() { if ((*it) != &quit_) delete (*it); } - connections_.clear(); } Response* SimpleWebServer::FindResponse(const Request& request) const { @@ -225,6 +224,7 @@ void SimpleWebServer::DidClose(net::ListenSocket* sock) { // 404's when the connection ends. Connection* c = FindConnection(sock); DCHECK(c); + c->OnSocketClosed(); if (!FindResponse(c->request())) { // extremely inefficient, but in one line and not that common... :) connections_.erase(std::find(connections_.begin(), connections_.end(), c)); diff --git a/chrome_frame/test/test_server.h b/chrome_frame/test/test_server.h index aa706d8..50ddf37 100644 --- a/chrome_frame/test/test_server.h +++ b/chrome_frame/test/test_server.h @@ -123,6 +123,10 @@ class Connection { return request_; } + void OnSocketClosed() { + socket_ = NULL; + } + protected: scoped_refptr<net::ListenSocket> socket_; Request request_; |