socket: Add RawConnect method

This commit is contained in:
klzgrad 2018-12-08 00:52:08 -05:00
parent 46f50c1c88
commit 0a91ac1e8c
2 changed files with 42 additions and 4 deletions

View File

@ -31,8 +31,8 @@ namespace {
// Limit of sockets of each socket pool. // Limit of sockets of each socket pool.
int g_max_sockets_per_pool[] = { int g_max_sockets_per_pool[] = {
256, // NORMAL_SOCKET_POOL 256, // NORMAL_SOCKET_POOL
256 // WEBSOCKET_SOCKET_POOL 256 // WEBSOCKET_SOCKET_POOL
}; };
static_assert(std::size(g_max_sockets_per_pool) == static_assert(std::size(g_max_sockets_per_pool) ==
@ -60,8 +60,8 @@ static_assert(std::size(g_max_sockets_per_group) ==
// http and SOCKS proxies. See http://crbug.com/12066 and // http and SOCKS proxies. See http://crbug.com/12066 and
// http://crbug.com/44501 for details about proxy server connection limits. // http://crbug.com/44501 for details about proxy server connection limits.
int g_max_sockets_per_proxy_server[] = { int g_max_sockets_per_proxy_server[] = {
kDefaultMaxSocketsPerProxyServer, // NORMAL_SOCKET_POOL kDefaultMaxSocketsPerProxyServer, // NORMAL_SOCKET_POOL
kDefaultMaxSocketsPerProxyServer // WEBSOCKET_SOCKET_POOL kDefaultMaxSocketsPerProxyServer // WEBSOCKET_SOCKET_POOL
}; };
static_assert(std::size(g_max_sockets_per_proxy_server) == static_assert(std::size(g_max_sockets_per_proxy_server) ==
@ -279,6 +279,30 @@ int InitSocketHandleForWebSocketRequest(
proxy_auth_callback); proxy_auth_callback);
} }
int InitSocketHandleForRawConnect2(
url::SchemeHostPort endpoint,
int request_load_flags,
RequestPriority request_priority,
HttpNetworkSession* session,
const ProxyInfo& proxy_info,
const SSLConfig& ssl_config_for_origin,
const SSLConfig& ssl_config_for_proxy,
PrivacyMode privacy_mode,
NetworkAnonymizationKey network_anonymization_key,
const NetLogWithSource& net_log,
ClientSocketHandle* socket_handle,
CompletionOnceCallback callback) {
DCHECK(socket_handle);
return InitSocketPoolHelper(
std::move(endpoint), request_load_flags, request_priority, session,
proxy_info, ssl_config_for_origin, ssl_config_for_proxy,
/*is_for_websockets=*/true, privacy_mode,
std::move(network_anonymization_key), SecureDnsPolicy::kDisable,
SocketTag(), net_log, 0, socket_handle,
HttpNetworkSession::NORMAL_SOCKET_POOL, std::move(callback),
ClientSocketPool::ProxyAuthCallback());
}
int PreconnectSocketsForHttpRequest( int PreconnectSocketsForHttpRequest(
url::SchemeHostPort endpoint, url::SchemeHostPort endpoint,
int request_load_flags, int request_load_flags,

View File

@ -120,6 +120,20 @@ int InitSocketHandleForWebSocketRequest(
CompletionOnceCallback callback, CompletionOnceCallback callback,
const ClientSocketPool::ProxyAuthCallback& proxy_auth_callback); const ClientSocketPool::ProxyAuthCallback& proxy_auth_callback);
NET_EXPORT int InitSocketHandleForRawConnect2(
url::SchemeHostPort endpoint,
int request_load_flags,
RequestPriority request_priority,
HttpNetworkSession* session,
const ProxyInfo& proxy_info,
const SSLConfig& ssl_config_for_origin,
const SSLConfig& ssl_config_for_proxy,
PrivacyMode privacy_mode,
NetworkAnonymizationKey network_anonymization_key,
const NetLogWithSource& net_log,
ClientSocketHandle* socket_handle,
CompletionOnceCallback callback);
// Similar to InitSocketHandleForHttpRequest except that it initiates the // Similar to InitSocketHandleForHttpRequest except that it initiates the
// desired number of preconnect streams from the relevant socket pool. // desired number of preconnect streams from the relevant socket pool.
int PreconnectSocketsForHttpRequest( int PreconnectSocketsForHttpRequest(