summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-09-02 01:59:48 +0100
committerKristian Monsen <kristianm@google.com>2011-09-02 02:07:24 +0100
commit06a415ae34c4542ee5d53da5162fa48ec332bfaa (patch)
tree7770b8288004e292ea16b371d499796f9f29184f /net
parent9eb037c1f79223822fda1b86c181948ff72fdd99 (diff)
downloadexternal_chromium-06a415ae34c4542ee5d53da5162fa48ec332bfaa.zip
external_chromium-06a415ae34c4542ee5d53da5162fa48ec332bfaa.tar.gz
external_chromium-06a415ae34c4542ee5d53da5162fa48ec332bfaa.tar.bz2
Adding method for closing idle connections
Part of fix for bug 4487538 Current Drain Being worked on upstream in: http://codereview.chromium.org/7380004/ Change-Id: I1b03aef9211e4dd2ad640c6c5b43622a105cbbd8
Diffstat (limited to 'net')
-rw-r--r--net/http/http_cache.cc8
-rw-r--r--net/http/http_cache.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 3943619..d53d525 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -459,6 +459,14 @@ void HttpCache::CloseAllConnections() {
session->CloseAllConnections();
}
+void HttpCache::CloseIdleConnections() {
+ net::HttpNetworkLayer* network =
+ static_cast<net::HttpNetworkLayer*>(network_layer_.get());
+ HttpNetworkSession* session = network->GetSession();
+ if (session)
+ session->CloseIdleConnections();
+}
+
int HttpCache::CreateTransaction(scoped_ptr<HttpTransaction>* trans) {
// Do lazy initialization of disk cache if needed.
if (!disk_cache_.get())
diff --git a/net/http/http_cache.h b/net/http/http_cache.h
index f1c5fbe..0a02506 100644
--- a/net/http/http_cache.h
+++ b/net/http/http_cache.h
@@ -178,6 +178,9 @@ class HttpCache : public HttpTransactionFactory,
// immediately, but they will not be reusable. This is for debugging.
void CloseAllConnections();
+ // Close all idle connections. Will close all sockets not in active use.
+ void CloseIdleConnections();
+
// HttpTransactionFactory implementation:
virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans);
virtual HttpCache* GetCache();