Commit 2ea4e82a authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make the number of restarts a parameter.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2068 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 1c8e6642
......@@ -69,6 +69,7 @@ DOT start -> recv [style=bold,color=green,weight=4]
#include "shmlog.h"
#include "vcl.h"
#include "heritage.h"
#include "cache.h"
static unsigned xids;
......@@ -707,6 +708,10 @@ cnt_recv(struct sess *sp)
AZ(sp->obj);
if (sp->restarts > params->max_restarts) {
sp->step = STP_ERROR;
return (0);
}
if (sp->restarts == 0) {
AZ(sp->vcl);
/* Update stats of various sorts */
......
......@@ -125,6 +125,9 @@ struct params {
/* LRU list ordering interval */
unsigned lru_timeout;
/* Maximum restarts allowed */
unsigned max_restarts;
};
extern volatile struct params *params;
......
......@@ -555,6 +555,14 @@ tweak_cc_command(struct cli *cli, struct parspec *par, const char *arg)
}
}
static void
tweak_max_restarts(struct cli *cli, struct parspec *par, const char *arg)
{
(void)par;
tweak_generic_uint(cli, &master.max_restarts, arg, 0, UINT_MAX);
}
/*--------------------------------------------------------------------*/
/*
......@@ -760,6 +768,14 @@ static struct parspec parspec[] = {
"exec cc -nostdinc -fpic -shared -Wl,-x -o %s -x c - < %s"
#endif
, NULL },
{ "max_restarts", tweak_max_restarts,
"Upper limit on how many times a request can restart."
#ifdef NOT_YET
" ESI:include counts as a restart in this context."
#endif
"\nBe aware that restarts are likely to cause a hit against "
"the backend, so don't increase thoughtlessly.\n",
"4", "restarts" },
{ NULL, NULL, NULL }
};
......
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