r903 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Wed Aug 23 09:30:42 CEST 2006
Author: phk
Date: 2006-08-23 09:30:42 +0200 (Wed, 23 Aug 2006)
New Revision: 903
Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_center.c
trunk/varnish-cache/bin/varnishd/cache_pass.c
Log:
Handle backend connection error in pass mode with a 503
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-23 07:29:28 UTC (rev 902)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-23 07:30:42 UTC (rev 903)
@@ -368,7 +368,7 @@
#undef HTTPH
/* cache_pass.c */
-void PassSession(struct sess *sp);
+int PassSession(struct sess *sp);
void PassBody(struct sess *sp);
/* cache_pipe.c */
Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-23 07:29:28 UTC (rev 902)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-23 07:30:42 UTC (rev 903)
@@ -492,9 +492,11 @@
{
assert(sp->vbc == NULL);
- PassSession(sp);
- assert(sp->vbc != NULL);
- sp->step = STP_PASSBODY;
+ if (!PassSession(sp)) {
+ assert(sp->vbc != NULL);
+ sp->step = STP_PASSBODY;
+ } else
+ sp->step = STP_DONE;
return (0);
}
Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-23 07:29:28 UTC (rev 902)
+++ trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-23 07:30:42 UTC (rev 903)
@@ -187,7 +187,7 @@
/*--------------------------------------------------------------------*/
-void
+int
PassSession(struct sess *sp)
{
int i;
@@ -199,6 +199,10 @@
w = sp->wrk;
vc = VBE_GetFd(sp->backend, sp->xid);
+ if (vc == NULL) {
+ RES_Error(sp, 503, "Backend did not respond.");
+ return (1);
+ }
assert(vc != NULL);
VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
@@ -218,4 +222,5 @@
assert(sp->vbc == NULL);
sp->vbc = vc;
+ return (0);
}
More information about the varnish-commit
mailing list