Commit 146d1035 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Convert remaining timeouts to double format.

parent ea435729
......@@ -173,13 +173,13 @@ vca_tcp_opt_init(void)
#endif
#ifdef HAVE_TCP_KEEP
} else if (!strcmp(to->strname, "TCP_KEEPIDLE")) {
x = cache_param->tcp_keepalive_time;
x = (int)(cache_param->tcp_keepalive_time);
NEW_VAL(to, x);
} else if (!strcmp(to->strname, "TCP_KEEPCNT")) {
x = cache_param->tcp_keepalive_probes;
x = (int)(cache_param->tcp_keepalive_probes);
NEW_VAL(to, x);
} else if (!strcmp(to->strname, "TCP_KEEPINTVL")) {
x = cache_param->tcp_keepalive_intvl;
x = (int)(cache_param->tcp_keepalive_intvl);
NEW_VAL(to, x);
#endif
}
......@@ -386,6 +386,7 @@ vca_acct(void *arg)
{
struct listen_sock *ls;
double t0, now;
unsigned u;
int i;
THR_SetName("cache-acceptor");
......@@ -398,12 +399,12 @@ vca_acct(void *arg)
continue;
AZ(listen(ls->sock, cache_param->listen_depth));
#ifdef HAVE_TCP_KEEP
vca_tcp_keep_probe(ls->sock,
TCP_KEEPIDLE, &cache_param->tcp_keepalive_time);
vca_tcp_keep_probe(ls->sock, TCP_KEEPIDLE, &u);
cache_param->tcp_keepalive_time = u;
vca_tcp_keep_probe(ls->sock,
TCP_KEEPCNT, &cache_param->tcp_keepalive_probes);
vca_tcp_keep_probe(ls->sock,
TCP_KEEPINTVL, &cache_param->tcp_keepalive_intvl);
vca_tcp_keep_probe(ls->sock, TCP_KEEPINTVL, &u);
cache_param->tcp_keepalive_intvl = u;
#endif
vca_tcp_opt_set(ls->sock, 1);
if (cache_param->accept_filter) {
......
......@@ -187,7 +187,7 @@ EXP_Touch(struct objcore *oc, double now)
if (oc->busyobj != NULL)
return;
if (now - oc->last_lru < cache_param->lru_timeout)
if (now - oc->last_lru < cache_param->lru_interval)
return;
lru = oc_getlru(oc);
......
......@@ -110,7 +110,7 @@ PipeRequest(struct req *req, struct busyobj *bo)
while (fds[0].fd > -1 || fds[1].fd > -1) {
fds[0].revents = 0;
fds[1].revents = 0;
i = poll(fds, 2, cache_param->pipe_timeout * 1000);
i = poll(fds, 2, (int)(cache_param->pipe_timeout * 1e3));
if (i < 1)
break;
if (fds[0].revents && rdf(vc->fd, req->sp->fd)) {
......
......@@ -107,13 +107,13 @@ struct params {
double timeout_linger;
double timeout_idle;
double timeout_req;
unsigned pipe_timeout;
unsigned send_timeout;
unsigned idle_send_timeout;
double pipe_timeout;
double send_timeout;
double idle_send_timeout;
#ifdef HAVE_TCP_KEEP
unsigned tcp_keepalive_time;
double tcp_keepalive_time;
unsigned tcp_keepalive_probes;
unsigned tcp_keepalive_intvl;
double tcp_keepalive_intvl;
#endif
/* Management hints */
......@@ -133,12 +133,12 @@ struct params {
unsigned listen_depth;
/* CLI related */
unsigned cli_timeout;
double cli_timeout;
unsigned cli_limit;
unsigned ping_interval;
/* LRU list ordering interval */
unsigned lru_timeout;
double lru_interval;
/* Maximum restarts allowed */
unsigned max_restarts;
......
......@@ -60,7 +60,6 @@ tweak_t tweak_listen_address;
tweak_t tweak_poolparam;
tweak_t tweak_string;
tweak_t tweak_timeout;
tweak_t tweak_timeout_double;
tweak_t tweak_uint;
tweak_t tweak_user;
tweak_t tweak_waiter;
......
......@@ -59,20 +59,20 @@ struct parspec mgt_parspec[] = {
"The unprivileged group to run as.",
MUST_RESTART,
"" },
{ "default_ttl", tweak_timeout_double, &mgt_param.default_ttl,
{ "default_ttl", tweak_timeout, &mgt_param.default_ttl,
"0", NULL,
"The TTL assigned to objects if neither the backend nor "
"the VCL code assigns one.",
OBJ_STICKY,
"20", "seconds" },
{ "default_grace", tweak_timeout_double, &mgt_param.default_grace,
{ "default_grace", tweak_timeout, &mgt_param.default_grace,
"0", NULL,
"Default grace period. We will deliver an object "
"this long after it has expired, provided another thread "
"is attempting to get a new copy.",
OBJ_STICKY,
"10", "seconds" },
{ "default_keep", tweak_timeout_double, &mgt_param.default_keep,
{ "default_keep", tweak_timeout, &mgt_param.default_keep,
"0", NULL,
"Default keep period. We will keep a useless object "
"around this long, making it available for conditional "
......@@ -172,14 +172,14 @@ struct parspec mgt_parspec[] = {
"Maximum is 65535 bytes.",
0,
"255", "bytes" },
{ "timeout_idle", tweak_timeout_double, &mgt_param.timeout_idle,
{ "timeout_idle", tweak_timeout, &mgt_param.timeout_idle,
"0", NULL,
"Idle timeout for client connections.\n"
"A connection is considered idle, until we receive"
" a non-white-space character on it.",
0,
"5", "seconds" },
{ "timeout_req", tweak_timeout_double, &mgt_param.timeout_req,
{ "timeout_req", tweak_timeout, &mgt_param.timeout_req,
"0", NULL,
"Max time to receive clients request header, measured"
" from first non-white-space character to double CRNL.",
......@@ -310,7 +310,7 @@ struct parspec mgt_parspec[] = {
"it possible to attach a debugger to the child.",
MUST_RESTART,
"3", "seconds" },
{ "lru_interval", tweak_timeout, &mgt_param.lru_timeout,
{ "lru_interval", tweak_timeout, &mgt_param.lru_interval,
"0", NULL,
"Grace period before object moves on LRU list.\n"
"Objects are only moved to the front of the LRU "
......@@ -344,7 +344,7 @@ struct parspec mgt_parspec[] = {
"Maximum depth of esi:include processing.",
0,
"5", "levels" },
{ "connect_timeout", tweak_timeout_double, &mgt_param.connect_timeout,
{ "connect_timeout", tweak_timeout, &mgt_param.connect_timeout,
"0", NULL,
"Default connection timeout for backend connections. "
"We only try to connect to the backend for this many "
......@@ -353,7 +353,7 @@ struct parspec mgt_parspec[] = {
"backend request.",
0,
"3.5", "s" },
{ "first_byte_timeout", tweak_timeout_double,
{ "first_byte_timeout", tweak_timeout,
&mgt_param.first_byte_timeout,
"0", NULL,
"Default timeout for receiving first byte from backend. "
......@@ -364,7 +364,7 @@ struct parspec mgt_parspec[] = {
"backend request. This parameter does not apply to pipe.",
0,
"60", "s" },
{ "between_bytes_timeout", tweak_timeout_double,
{ "between_bytes_timeout", tweak_timeout,
&mgt_param.between_bytes_timeout,
"0", NULL,
"Default timeout between bytes when receiving data from "
......@@ -375,7 +375,7 @@ struct parspec mgt_parspec[] = {
"and backend request. This parameter does not apply to pipe.",
0,
"60", "s" },
{ "acceptor_sleep_max", tweak_timeout_double,
{ "acceptor_sleep_max", tweak_timeout,
&mgt_param.acceptor_sleep_max,
"0", "10",
"If we run out of resources, such as file descriptors or "
......@@ -384,7 +384,7 @@ struct parspec mgt_parspec[] = {
"attempts to accept new connections.",
EXPERIMENTAL,
"0.050", "s" },
{ "acceptor_sleep_incr", tweak_timeout_double,
{ "acceptor_sleep_incr", tweak_timeout,
&mgt_param.acceptor_sleep_incr,
"0", "1",
"If we run out of resources, such as file descriptors or "
......@@ -424,7 +424,7 @@ struct parspec mgt_parspec[] = {
"it.",
0,
"100000", "sessions" },
{ "timeout_linger", tweak_timeout_double, &mgt_param.timeout_linger,
{ "timeout_linger", tweak_timeout, &mgt_param.timeout_linger,
"0", NULL,
"How long time the workerthread lingers on an idle session "
"before handing it over to the waiter.\n"
......@@ -451,7 +451,7 @@ struct parspec mgt_parspec[] = {
"Log all CLI traffic to syslog(LOG_INFO).",
0,
"on", "bool" },
{ "ban_lurker_sleep", tweak_timeout_double,
{ "ban_lurker_sleep", tweak_timeout,
&mgt_param.ban_lurker_sleep,
"0", NULL,
"How long time does the ban lurker thread sleeps between "
......@@ -502,14 +502,14 @@ struct parspec mgt_parspec[] = {
" just a waste of memory.",
EXPERIMENTAL,
"32k", "bytes" },
{ "shortlived", tweak_timeout_double,
{ "shortlived", tweak_timeout,
&mgt_param.shortlived,
"0", NULL,
"Objects created with TTL shorter than this are always "
"put in transient storage.",
0,
"10.0", "s" },
{ "critbit_cooloff", tweak_timeout_double,
{ "critbit_cooloff", tweak_timeout,
&mgt_param.critbit_cooloff,
"60", "254",
"How long time the critbit hasher keeps deleted objheads "
......
......@@ -104,25 +104,7 @@ tweak_generic_double(struct vsb *vsb, volatile double *dest,
/*--------------------------------------------------------------------*/
int
tweak_timeout(struct vsb *vsb, const struct parspec *par, const char *arg)
{
int i;
double d;
volatile unsigned *dest;
dest = par->priv;
d = *dest;
i = tweak_generic_double(vsb, &d, arg, par->min, par->max, "%.0f");
if (!i) {
*dest = (unsigned)ceil(d);
}
return (i);
}
/*--------------------------------------------------------------------*/
int
tweak_timeout_double(struct vsb *vsb, const struct parspec *par,
tweak_timeout(struct vsb *vsb, const struct parspec *par,
const char *arg)
{
volatile double *dest;
......
......@@ -126,7 +126,7 @@ struct parspec WRK_parspec[] = {
DELAYED_EFFECT,
"100", "threads" },
{ "thread_pool_timeout",
tweak_timeout_double, &mgt_param.wthread_timeout,
tweak_timeout, &mgt_param.wthread_timeout,
"10", NULL,
"Thread idle threshold.\n"
"\n"
......@@ -137,7 +137,7 @@ struct parspec WRK_parspec[] = {
EXPERIMENTAL | DELAYED_EFFECT,
"300", "seconds" },
{ "thread_pool_destroy_delay",
tweak_timeout_double, &mgt_param.wthread_destroy_delay,
tweak_timeout, &mgt_param.wthread_destroy_delay,
"0.01", NULL,
"Wait this long after destroying a thread.\n"
"\n"
......@@ -147,7 +147,7 @@ struct parspec WRK_parspec[] = {
EXPERIMENTAL | DELAYED_EFFECT,
"1", "seconds" },
{ "thread_pool_add_delay",
tweak_timeout_double, &mgt_param.wthread_add_delay,
tweak_timeout, &mgt_param.wthread_add_delay,
"0", NULL,
"Wait at least this long after creating a thread.\n"
"\n"
......@@ -160,7 +160,7 @@ struct parspec WRK_parspec[] = {
EXPERIMENTAL,
"0", "seconds" },
{ "thread_pool_fail_delay",
tweak_timeout_double, &mgt_param.wthread_fail_delay,
tweak_timeout, &mgt_param.wthread_fail_delay,
"10e-3", NULL,
"Wait at least this long after a failed thread creation "
"before trying to create another thread.\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment