diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_network_session.cc | 22 | ||||
-rw-r--r-- | net/http/http_network_session.h | 14 | ||||
-rw-r--r-- | net/net.gyp | 1 |
3 files changed, 31 insertions, 6 deletions
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc new file mode 100644 index 0000000..a498ed0 --- /dev/null +++ b/net/http/http_network_session.cc @@ -0,0 +1,22 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/http/http_network_session.h" + +#include "base/logging.h" + +namespace net { + +// static +int HttpNetworkSession::max_sockets_per_group_ = 6; + +// static +void HttpNetworkSession::set_max_sockets_per_group(int socket_count) { + DCHECK(0 < socket_count); + // The following is a sanity check... but we should NEVER be near this value. + DCHECK(100 > socket_count); + max_sockets_per_group_ = socket_count; +} + +} // namespace net diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index 2dd1b89..7c4ac68 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h @@ -17,13 +17,8 @@ class ProxyService; // This class holds session objects used by HttpNetworkTransaction objects. class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> { public: - // Allow up to 6 connections per host. - enum { - MAX_SOCKETS_PER_GROUP = 6 - }; - explicit HttpNetworkSession(ProxyService* proxy_service) - : connection_pool_(new ClientSocketPool(MAX_SOCKETS_PER_GROUP)), + : connection_pool_(new ClientSocketPool(max_sockets_per_group_)), proxy_service_(proxy_service) { DCHECK(proxy_service); } @@ -35,7 +30,14 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> { SSLConfigService* ssl_config_service() { return &ssl_config_service_; } #endif + static void set_max_sockets_per_group(int socket_count); + private: + // Default to allow up to 6 connections per host. Experiment and tuning may + // try other values (greater than 0). Too large may cause many problems, such + // as home routers blocking the connections!?!? + static int max_sockets_per_group_; + HttpAuthCache auth_cache_; scoped_refptr<ClientSocketPool> connection_pool_; ProxyService* proxy_service_; diff --git a/net/net.gyp b/net/net.gyp index ca972fc..cfd17f6 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -217,6 +217,7 @@ 'http/http_chunked_decoder.h', 'http/http_network_layer.cc', 'http/http_network_layer.h', + 'http/http_network_session.cc', 'http/http_network_session.h', 'http/http_network_transaction.cc', 'http/http_network_transaction.h', |