Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(880)

Side by Side Diff: net/socket/client_socket_pool_manager.cc

Issue 7283018: Introduce a policy to control the maximal number of connections per proxy server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make the bots happy with the policy template. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/socket/client_socket_pool_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // ClientSocketPoolManager manages access to all ClientSocketPools. It's a 5 // ClientSocketPoolManager manages access to all ClientSocketPools. It's a
6 // simple container for all of them. Most importantly, it handles the lifetime 6 // simple container for all of them. Most importantly, it handles the lifetime
7 // and destruction order properly. 7 // and destruction order properly.
8 8
9 #include "net/socket/client_socket_pool_manager.h" 9 #include "net/socket/client_socket_pool_manager.h"
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "net/base/ssl_config_service.h" 16 #include "net/base/ssl_config_service.h"
17 #include "net/http/http_network_session.h" 17 #include "net/http/http_network_session.h"
18 #include "net/http/http_proxy_client_socket_pool.h" 18 #include "net/http/http_proxy_client_socket_pool.h"
19 #include "net/http/http_request_info.h" 19 #include "net/http/http_request_info.h"
20 #include "net/proxy/proxy_service.h" 20 #include "net/proxy/proxy_service.h"
21 #include "net/socket/client_socket_factory.h" 21 #include "net/socket/client_socket_factory.h"
22 #include "net/socket/client_socket_handle.h" 22 #include "net/socket/client_socket_handle.h"
23 #include "net/socket/client_socket_pool_histograms.h" 23 #include "net/socket/client_socket_pool_histograms.h"
24 #include "net/socket/socks_client_socket_pool.h" 24 #include "net/socket/socks_client_socket_pool.h"
25 #include "net/socket/ssl_client_socket_pool.h" 25 #include "net/socket/ssl_client_socket_pool.h"
26 #include "net/socket/transport_client_socket_pool.h" 26 #include "net/socket/transport_client_socket_pool.h"
27 27
28 namespace net { 28 namespace net {
29 29
30 const int kDefaultMaxSocketsPerProxyServer = 32;
31
30 namespace { 32 namespace {
31 33
32 // Total limit of sockets. 34 // Total limit of sockets.
33 int g_max_sockets = 256; 35 int g_max_sockets = 256;
34 36
35 // Default to allow up to 6 connections per host. Experiment and tuning may 37 // Default to allow up to 6 connections per host. Experiment and tuning may
36 // try other values (greater than 0). Too large may cause many problems, such 38 // try other values (greater than 0). Too large may cause many problems, such
37 // as home routers blocking the connections!?!? See http://crbug.com/12066. 39 // as home routers blocking the connections!?!? See http://crbug.com/12066.
38 int g_max_sockets_per_group = 6; 40 int g_max_sockets_per_group = 6;
39 41
40 // The max number of sockets to allow per proxy server. This applies both to 42 // The max number of sockets to allow per proxy server. This applies both to
41 // http and SOCKS proxies. See http://crbug.com/12066 and 43 // http and SOCKS proxies. See http://crbug.com/12066 and
42 // http://crbug.com/44501 for details about proxy server connection limits. 44 // http://crbug.com/44501 for details about proxy server connection limits.
43 int g_max_sockets_per_proxy_server = 32; 45 int g_max_sockets_per_proxy_server = kDefaultMaxSocketsPerProxyServer;
44 46
45 // Appends information about all |socket_pools| to the end of |list|. 47 // Appends information about all |socket_pools| to the end of |list|.
46 template <class MapType> 48 template <class MapType>
47 static void AddSocketPoolsToList(ListValue* list, 49 static void AddSocketPoolsToList(ListValue* list,
48 const MapType& socket_pools, 50 const MapType& socket_pools,
49 const std::string& type, 51 const std::string& type,
50 bool include_nested_pools) { 52 bool include_nested_pools) {
51 for (typename MapType::const_iterator it = socket_pools.begin(); 53 for (typename MapType::const_iterator it = socket_pools.begin();
52 it != socket_pools.end(); it++) { 54 it != socket_pools.end(); it++) {
53 list->Append(it->second->GetInfoAsValue(it->first.ToString(), 55 list->Append(it->second->GetInfoAsValue(it->first.ToString(),
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 ssl_config_for_proxy, 711 ssl_config_for_proxy,
710 false, 712 false,
711 net_log, 713 net_log,
712 num_preconnect_streams, 714 num_preconnect_streams,
713 NULL, 715 NULL,
714 NULL); 716 NULL);
715 } 717 }
716 718
717 719
718 } // namespace net 720 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/client_socket_pool_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698