]> err.no Git - varnish/commitdiff
Make the director opaque outside the backend code.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 21 Aug 2008 08:48:29 +0000 (08:48 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Thu, 21 Aug 2008 08:48:29 +0000 (08:48 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3119 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_backend.h
varnish-cache/bin/varnishd/cache_center.c
varnish-cache/bin/varnishd/cache_dir_random.c
varnish-cache/bin/varnishd/cache_dir_round_robin.c
varnish-cache/bin/varnishd/cache_dir_simple.c
varnish-cache/bin/varnishd/cache_fetch.c

index 0560ae687d33dae661375175e712076c88ff7801..e7385e9bdf380b1092e9640134e8c614f9db10e1 100644 (file)
@@ -76,6 +76,7 @@ enum {
 struct cli;
 struct vsb;
 struct sess;
+struct director;
 struct object;
 struct objhead;
 struct objexp;
@@ -372,22 +373,6 @@ struct sess {
        const char              **hashptr;
 };
 
-/* -------------------------------------------------------------------
- * A director is a piece of code which selects one of possibly multiple
- * backends to use.
- */
-
-typedef struct backend *vdi_choose_f(struct sess *sp);
-typedef void vdi_fini_f(struct director *d);
-
-struct director {
-       unsigned                magic;
-#define DIRECTOR_MAGIC         0x3336351d
-       const char              *name;
-       vdi_choose_f            *choose;
-       vdi_fini_f              *fini;
-       void                    *priv;
-};
 
 /* -------------------------------------------------------------------*/
 
index 2abdf35376c6fbb457066b78190a8ea8519f1a21..21641cfa6b24e5316c571d30e82791972bb6ee7b 100644 (file)
 struct vbp_target;
 struct vrt_backend_probe;
 
+/* -------------------------------------------------------------------
+ * A director is a piece of code which selects one of possibly multiple
+ * backends to use.
+ */
+
+typedef struct backend *vdi_choose_f(struct sess *sp);
+typedef void vdi_fini_f(struct director *d);
+
+struct director {
+       unsigned                magic;
+#define DIRECTOR_MAGIC         0x3336351d
+       const char              *name;
+       vdi_choose_f            *choose;
+       vdi_fini_f              *fini;
+       void                    *priv;
+};
+
 /* Backend indstance */
 struct backend {
        unsigned                magic;
index 193fdd8a97bd6749978d02b34e7683cff7854bec..885dc0255d31dd23750e6a927002b0c5ef8bc8e7 100644 (file)
@@ -388,12 +388,11 @@ cnt_fetch(struct sess *sp)
        CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
 
        AN(sp->bereq);
-       CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC);
+       AN(sp->director);
        i = Fetch(sp);
-       CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC);
+       AN(sp->director);
 
        if (i) {
-VSL(SLT_Debug, sp->fd, "Fetch = %d", i);
                sp->err_code = 503;
                sp->step = STP_ERROR;
                VBE_free_bereq(sp->bereq);
@@ -854,7 +853,7 @@ cnt_recv(struct sess *sp)
        /* By default we use the first backend */
        AZ(sp->director);
        sp->director = sp->vcl->director[0];
-       CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC);
+       AN(sp->director);
 
        VCL_recv_method(sp);
 
@@ -996,7 +995,6 @@ CNT_Session(struct sess *sp)
                CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
                CHECK_OBJ_ORNULL(w->nobj, OBJECT_MAGIC);
                CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC);
-               CHECK_OBJ_ORNULL(sp->director, DIRECTOR_MAGIC);
 
                switch (sp->step) {
 #define STEP(l,u) \
index f2890c38c1dcd2c043b849dbbd5dbff1d6c49e3b..4eedee13d072dc08fbd74d7e0f2ed0748ac13e42 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "shmlog.h"
 #include "cache.h"
+#include "cache_backend.h"
 #include "vrt.h"
 
 /*--------------------------------------------------------------------*/
index 18fe8b19b1111f5cfb01888f2d5c761a2d0c5424..70efa4ad173269fcc791c602b68edd8caf46f666 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "shmlog.h"
 #include "cache.h"
+#include "cache_backend.h"
 #include "vrt.h"
 
 /*--------------------------------------------------------------------*/
index 672d4d551d8468bb7a3891badc7352d5eace6b93..1fb9ac1761f1119fb37a68759f11b8079f208d6b 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "shmlog.h"
 #include "cache.h"
+#include "cache_backend.h"
 #include "vrt.h"
 
 /*--------------------------------------------------------------------*/
index 681d894c5d940ab03493a91ebfe3731badd854ea..19b6771aada630f6fe3f307dda491de25fe07ffb 100644 (file)
@@ -321,7 +321,7 @@ Fetch(struct sess *sp)
        CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
        CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
        CHECK_OBJ_NOTNULL(sp->bereq, BEREQ_MAGIC);
-       CHECK_OBJ_NOTNULL(sp->director, DIRECTOR_MAGIC);
+       AN(sp->director);
        assert(sp->obj->busy != 0);
        w = sp->wrk;
        bereq = sp->bereq;