summaryrefslogtreecommitdiffstats
path: root/net/socket/tcp_client_socket_pool.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/socket/tcp_client_socket_pool.cc')
-rw-r--r--net/socket/tcp_client_socket_pool.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/net/socket/tcp_client_socket_pool.cc b/net/socket/tcp_client_socket_pool.cc
index decc23f1..197ccdb 100644
--- a/net/socket/tcp_client_socket_pool.cc
+++ b/net/socket/tcp_client_socket_pool.cc
@@ -18,14 +18,19 @@ using base::TimeDelta;
namespace net {
+// TCPConnectJobs will time out after this many seconds. Note this is the total
+// time, including both host resolution and TCP connect() times.
+static const int kTCPConnectJobTimeoutInSeconds = 60;
+
TCPConnectJob::TCPConnectJob(
const std::string& group_name,
const HostResolver::RequestInfo& resolve_info,
const ClientSocketHandle* handle,
+ base::TimeDelta timeout_duration,
ClientSocketFactory* client_socket_factory,
HostResolver* host_resolver,
Delegate* delegate)
- : ConnectJob(group_name, handle, delegate),
+ : ConnectJob(group_name, handle, timeout_duration, delegate),
resolve_info_(resolve_info),
client_socket_factory_(client_socket_factory),
ALLOW_THIS_IN_INITIALIZER_LIST(
@@ -38,7 +43,7 @@ TCPConnectJob::~TCPConnectJob() {
// ~SingleRequestHostResolver and ~ClientSocket will take care of it.
}
-int TCPConnectJob::Connect() {
+int TCPConnectJob::ConnectInternal() {
next_state_ = kStateResolveHost;
return DoLoop(OK);
}
@@ -128,6 +133,7 @@ ConnectJob* TCPClientSocketPool::TCPConnectJobFactory::NewConnectJob(
ConnectJob::Delegate* delegate) const {
return new TCPConnectJob(
group_name, request.resolve_info, request.handle,
+ base::TimeDelta::FromSeconds(kTCPConnectJobTimeoutInSeconds),
client_socket_factory_, host_resolver_, delegate);
}