Mailing List Archive

r2632 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2008-04-21 08:33:37 +0200 (Mon, 21 Apr 2008)
New Revision: 2632

Modified:
trunk/varnish-cache/bin/varnishd/cache_acceptor.c
trunk/varnish-cache/bin/varnishd/cache_acceptor.h
Log:
Make it possible for the acceptor to provide a method by which sessions
are passed to it.

If no method is provided, we fall back to vca_pipes.

closes #227


Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2008-04-17 20:08:49 UTC (rev 2631)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2008-04-21 06:33:37 UTC (rev 2632)
@@ -270,7 +270,10 @@
AZ(sp->obj);
AZ(sp->vcl);
assert(sp->fd >= 0);
- assert(sizeof sp == write(vca_pipes[1], &sp, sizeof sp));
+ if (vca_act->pass == NULL)
+ assert(sizeof sp == write(vca_pipes[1], &sp, sizeof sp));
+ else
+ vca_act->pass(sp);
}


@@ -290,7 +293,8 @@
fprintf(stderr, "No acceptor in program\n");
exit (2);
}
- AZ(pipe(vca_pipes));
+ if (vca_act->pass == NULL)
+ AZ(pipe(vca_pipes));
vca_act->init();
AZ(pthread_create(&vca_thread_acct, NULL, vca_acct, NULL));
VSL(SLT_Debug, 0, "Acceptor is %s", vca_act->name);

Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.h 2008-04-17 20:08:49 UTC (rev 2631)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.h 2008-04-21 06:33:37 UTC (rev 2632)
@@ -32,10 +32,12 @@
struct sess;

typedef void acceptor_init_f(void);
+typedef void acceptor_pass_f(struct sess *);

struct acceptor {
const char *name;
acceptor_init_f *init;
+ acceptor_pass_f *pass;
};

#if defined(HAVE_EPOLL_CTL)