OLD | NEW |
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 | |
32 namespace { | 30 namespace { |
33 | 31 |
34 // Total limit of sockets. | 32 // Total limit of sockets. |
35 int g_max_sockets = 256; | 33 int g_max_sockets = 256; |
36 | 34 |
37 // Default to allow up to 6 connections per host. Experiment and tuning may | 35 // Default to allow up to 6 connections per host. Experiment and tuning may |
38 // try other values (greater than 0). Too large may cause many problems, such | 36 // try other values (greater than 0). Too large may cause many problems, such |
39 // as home routers blocking the connections!?!? See http://crbug.com/12066. | 37 // as home routers blocking the connections!?!? See http://crbug.com/12066. |
40 int g_max_sockets_per_group = 6; | 38 int g_max_sockets_per_group = 6; |
41 | 39 |
42 // The max number of sockets to allow per proxy server. This applies both to | 40 // The max number of sockets to allow per proxy server. This applies both to |
43 // http and SOCKS proxies. See http://crbug.com/12066 and | 41 // http and SOCKS proxies. See http://crbug.com/12066 and |
44 // http://crbug.com/44501 for details about proxy server connection limits. | 42 // http://crbug.com/44501 for details about proxy server connection limits. |
45 int g_max_sockets_per_proxy_server = kDefaultMaxSocketsPerProxyServer; | 43 int g_max_sockets_per_proxy_server = 32; |
46 | 44 |
47 // Appends information about all |socket_pools| to the end of |list|. | 45 // Appends information about all |socket_pools| to the end of |list|. |
48 template <class MapType> | 46 template <class MapType> |
49 static void AddSocketPoolsToList(ListValue* list, | 47 static void AddSocketPoolsToList(ListValue* list, |
50 const MapType& socket_pools, | 48 const MapType& socket_pools, |
51 const std::string& type, | 49 const std::string& type, |
52 bool include_nested_pools) { | 50 bool include_nested_pools) { |
53 for (typename MapType::const_iterator it = socket_pools.begin(); | 51 for (typename MapType::const_iterator it = socket_pools.begin(); |
54 it != socket_pools.end(); it++) { | 52 it != socket_pools.end(); it++) { |
55 list->Append(it->second->GetInfoAsValue(it->first.ToString(), | 53 list->Append(it->second->GetInfoAsValue(it->first.ToString(), |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 ssl_config_for_proxy, | 709 ssl_config_for_proxy, |
712 false, | 710 false, |
713 net_log, | 711 net_log, |
714 num_preconnect_streams, | 712 num_preconnect_streams, |
715 NULL, | 713 NULL, |
716 NULL); | 714 NULL); |
717 } | 715 } |
718 | 716 |
719 | 717 |
720 } // namespace net | 718 } // namespace net |
OLD | NEW |