]> err.no Git - varnish/commitdiff
Make init an optional method for backends
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 20 Sep 2007 07:22:56 +0000 (07:22 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 20 Sep 2007 07:22:56 +0000 (07:22 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1962 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_backend.c
varnish-cache/bin/varnishd/cache_backend_simple.c

index 3d32ca282818dd59dda5a13dc5b5e6c0dfa30c90..cad9b4880c3a063005d4eacbe2742e04579cc005 100644 (file)
@@ -249,12 +249,22 @@ VBE_UpdateHealth(struct sess *sp, struct vbe_conn *vc, int a)
 
 /*--------------------------------------------------------------------*/
 
+static void
+VBE_AddBackendMethod(struct backend_method *bem)
+{
+
+       if (bem->init != NULL)
+               bem->init();
+}
+
+/*--------------------------------------------------------------------*/
+
 void
 VBE_Init(void)
 {
 
        MTX_INIT(&VBE_mtx);
-       backend_method_simple.init();
-       backend_method_random.init();
-       backend_method_round_robin.init();
+       VBE_AddBackendMethod(&backend_method_simple);
+       VBE_AddBackendMethod(&backend_method_random);
+       VBE_AddBackendMethod(&backend_method_round_robin);
 }
index 349cfc867c9137596708859e3e8f13e9f6b55bb0..1822d5ddf5de30849517c1c9855ff72d293aa5ee 100644 (file)
@@ -347,14 +347,6 @@ bes_GetHostname(struct backend *b)
 
 /*--------------------------------------------------------------------*/
 
-static void
-bes_Init(void)
-{
-
-}
-
-/*--------------------------------------------------------------------*/
-
 struct backend_method backend_method_simple = {
        .name =                 "simple",
        .getfd =                bes_GetFd,
@@ -362,7 +354,6 @@ struct backend_method backend_method_simple = {
        .recycle =              bes_RecycleFd,
        .gethostname =          bes_GetHostname,
        .cleanup =              bes_Cleanup,
-       .init =                 bes_Init
 };
 
 /*--------------------------------------------------------------------*/