Commit 15d0b83f authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Be much more paranoid about backends, now that they can go away.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1917 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 93e5e808
......@@ -297,7 +297,9 @@ cnt_fetch(struct sess *sp)
int i;
AN(sp->bereq);
CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC);
i = Fetch(sp);
CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC);
/* Experimental. Set time for last check of backend health.
* If the backend replied with 200, it is obviously up and running,
......@@ -426,6 +428,7 @@ cnt_hit(struct sess *sp)
/* Experimental. Reduce health parameter of backend towards zero
* if it has been more than a minute since it was checked. */
CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC);
time_diff = TIM_mono() - sp->backend->last_check;
minutes = time_diff / 60;
if (minutes > sp->backend->minute_limit) {
......@@ -759,7 +762,9 @@ cnt_recv(struct sess *sp)
http_DoConnection(sp);
/* By default we use the first backend */
AZ(sp->backend);
sp->backend = sp->vcl->backend[0];
CHECK_OBJ_NOTNULL(sp->backend, BACKEND_MAGIC);
/* XXX: Handle TRACE & OPTIONS of Max-Forwards = 0 */
......@@ -817,6 +822,8 @@ CNT_Session(struct sess *sp)
CHECK_OBJ(w->nobj, OBJECT_MAGIC);
if (w->nobjhead != NULL)
CHECK_OBJ(w->nobjhead, OBJHEAD_MAGIC);
if (sp->backend != NULL)
CHECK_OBJ(sp->backend, BACKEND_MAGIC);
switch (sp->step) {
#define STEP(l,u) case STP_##u: done = cnt_##l(sp); break;
......
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