Mailing List Archive

r1060 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2006-09-18 09:16:03 +0200 (Mon, 18 Sep 2006)
New Revision: 1060

Modified:
trunk/varnish-cache/bin/varnishd/cache_backend.c
Log:
Add a simple linear retry in five steps for backend connection.


Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-09-18 07:11:49 UTC (rev 1059)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-09-18 07:16:03 UTC (rev 1060)
@@ -260,12 +260,16 @@
VBE_GetFd(struct sess *sp)
{
struct vbe_conn *vc;
+ unsigned n;

- vc = vbe_nextfd(sp);
- if (vc != NULL) {
- WSL(sp->wrk, SLT_Backend, sp->fd, "%d %s", vc->fd,
- sp->backend->vcl_name);
- return (vc);
+ for (n = 1; n < 5; n++) {
+ vc = vbe_nextfd(sp);
+ if (vc != NULL) {
+ WSL(sp->wrk, SLT_Backend, sp->fd, "%d %s", vc->fd,
+ sp->backend->vcl_name);
+ return (vc);
+ }
+ usleep(100000 * n);
}
RES_Error(sp, 503, "Backend did not respond.");
return (NULL);