blob: a1967efdbab2b12a340ad7cb37e8af1596d82f45 [file] [log] [blame]
[email protected]82b8c962011-10-12 09:17:301// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]554cee372011-10-12 06:54:082// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "net/socket/client_socket_pool.h"
6
[email protected]82b8c962011-10-12 09:17:307#include "base/logging.h"
8
[email protected]554cee372011-10-12 06:54:089namespace {
10
[email protected]82b8c962011-10-12 09:17:3011// The maximum duration, in seconds, to keep unused idle persistent sockets
[email protected]554cee372011-10-12 06:54:0812// alive.
13// TODO(ziadh): Change this timeout after getting histogram data on how long it
14// should be.
[email protected]82b8c962011-10-12 09:17:3015int g_unused_idle_socket_timeout_s = 10;
16
17// The maximum duration, in seconds, to keep used idle persistent sockets alive.
18int g_used_idle_socket_timeout_s = 300; // 5 minutes
[email protected]554cee372011-10-12 06:54:0819
20} // namespace
21
22namespace net {
23
24// static
[email protected]82b8c962011-10-12 09:17:3025base::TimeDelta ClientSocketPool::unused_idle_socket_timeout() {
26 return base::TimeDelta::FromSeconds(g_unused_idle_socket_timeout_s);
[email protected]554cee372011-10-12 06:54:0827}
28
29// static
[email protected]82b8c962011-10-12 09:17:3030void ClientSocketPool::set_unused_idle_socket_timeout(base::TimeDelta timeout) {
31 DCHECK_GT(timeout.InSeconds(), 0);
32 g_unused_idle_socket_timeout_s = timeout.InSeconds();
33}
34
35// static
36base::TimeDelta ClientSocketPool::used_idle_socket_timeout() {
37 return base::TimeDelta::FromSeconds(g_used_idle_socket_timeout_s);
38}
39
40// static
41void ClientSocketPool::set_used_idle_socket_timeout(base::TimeDelta timeout) {
42 DCHECK_GT(timeout.InSeconds(), 0);
43 g_used_idle_socket_timeout_s = timeout.InSeconds();
[email protected]554cee372011-10-12 06:54:0844}
45
46ClientSocketPool::ClientSocketPool() {}
47
48ClientSocketPool::~ClientSocketPool() {}
49
50} // namespace net