Commit 561be2ef authored by Tollef Fog Heen's avatar Tollef Fog Heen

Make it possible to limit the total transfer time.

Set the default total transfer time to 600s.
parent 35f8ce5d
......@@ -318,9 +318,9 @@ vca_acct(void *arg)
while (1) {
(void)sleep(1);
#ifdef SO_SNDTIMEO_WORKS
if (params->send_timeout != send_timeout) {
if (params->idle_send_timeout != send_timeout) {
need_test = 1;
send_timeout = params->send_timeout;
send_timeout = params->idle_send_timeout;
tv_sndtimeo = VTIM_timeval(send_timeout);
VTAILQ_FOREACH(ls, &heritage.socks, list) {
if (ls->sock < 0)
......
......@@ -51,6 +51,7 @@
#include <stdio.h>
#include "cache.h"
#include "vtim.h"
/*--------------------------------------------------------------------
*/
......@@ -133,6 +134,14 @@ WRW_Flush(struct worker *w)
*/
size_t used = 0;
if (VTIM_real() - w->sp->t_resp > params->send_timeout) {
WSL(w, SLT_Debug, *wrw->wfd,
"Hit total send timeout, wrote = %ld/%ld; not retrying",
i, wrw->liov);
i = -1;
break;
}
WSL(w, SLT_Debug, *wrw->wfd,
"Hit send timeout, wrote = %ld/%ld; retrying",
i, wrw->liov);
......
......@@ -112,6 +112,7 @@ struct params {
unsigned sess_timeout;
unsigned pipe_timeout;
unsigned send_timeout;
unsigned idle_send_timeout;
/* Management hints */
unsigned auto_restart;
......
......@@ -613,6 +613,13 @@ static const struct parspec input_parspec[] = {
"seconds the session is closed. \n"
"See setsockopt(2) under SO_SNDTIMEO for more information.",
DELAYED_EFFECT,
"600", "seconds" },
{ "idle_send_timeout", tweak_timeout, &master.idle_send_timeout, 0, 0,
"Time to wait with no data sent. "
"If no data has been transmitted in this many\n"
"seconds the session is closed. \n"
"See setsockopt(2) under SO_SNDTIMEO for more information.",
DELAYED_EFFECT,
"60", "seconds" },
{ "auto_restart", tweak_bool, &master.auto_restart, 0, 0,
"Restart child process automatically if it dies.\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