From: phk Date: Mon, 21 Apr 2008 06:33:37 +0000 (+0000) Subject: Make it possible for the acceptor to provide a method by which sessions X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8c413bc741b50f0ddf5df22670875ed88f0eeb3;p=varnish 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 git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2632 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_acceptor.c b/varnish-cache/bin/varnishd/cache_acceptor.c index 69019d22..6394cee0 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor.c +++ b/varnish-cache/bin/varnishd/cache_acceptor.c @@ -270,7 +270,10 @@ vca_return_session(struct sess *sp) 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 @@ ccf_start(struct cli *cli, const char * const *av, void *priv) 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); diff --git a/varnish-cache/bin/varnishd/cache_acceptor.h b/varnish-cache/bin/varnishd/cache_acceptor.h index 06e8c206..dcda822e 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor.h +++ b/varnish-cache/bin/varnishd/cache_acceptor.h @@ -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)