r3119 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Thu Aug 21 10:48:30 CEST 2008


Author: phk
Date: 2008-08-21 10:48:29 +0200 (Thu, 21 Aug 2008)
New Revision: 3119

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_backend.h
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_dir_random.c
   trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c
   trunk/varnish-cache/bin/varnishd/cache_dir_simple.c
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
Log:
Make the director opaque outside the backend code.



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2008-08-21 08:37:37 UTC (rev 3118)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2008-08-21 08:48:29 UTC (rev 3119)
@@ -76,6 +76,7 @@
 struct cli;
 struct vsb;
 struct sess;
+struct director;
 struct object;
 struct objhead;
 struct objexp;
@@ -372,23 +373,7 @@
 	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;
-};
-
 /* -------------------------------------------------------------------*/
 
 /* Backend connection */

Modified: trunk/varnish-cache/bin/varnishd/cache_backend.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.h	2008-08-21 08:37:37 UTC (rev 3118)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.h	2008-08-21 08:48:29 UTC (rev 3119)
@@ -71,6 +71,23 @@
 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;

Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2008-08-21 08:37:37 UTC (rev 3118)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2008-08-21 08:48:29 UTC (rev 3119)
@@ -388,12 +388,11 @@
 	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 @@
 	/* 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 @@
 		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) \

Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir_random.c	2008-08-21 08:37:37 UTC (rev 3118)
+++ trunk/varnish-cache/bin/varnishd/cache_dir_random.c	2008-08-21 08:48:29 UTC (rev 3119)
@@ -43,6 +43,7 @@
 
 #include "shmlog.h"
 #include "cache.h"
+#include "cache_backend.h"
 #include "vrt.h"
 
 /*--------------------------------------------------------------------*/

Modified: trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c	2008-08-21 08:37:37 UTC (rev 3118)
+++ trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c	2008-08-21 08:48:29 UTC (rev 3119)
@@ -41,6 +41,7 @@
 
 #include "shmlog.h"
 #include "cache.h"
+#include "cache_backend.h"
 #include "vrt.h"
 
 /*--------------------------------------------------------------------*/

Modified: trunk/varnish-cache/bin/varnishd/cache_dir_simple.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir_simple.c	2008-08-21 08:37:37 UTC (rev 3118)
+++ trunk/varnish-cache/bin/varnishd/cache_dir_simple.c	2008-08-21 08:48:29 UTC (rev 3119)
@@ -43,6 +43,7 @@
 
 #include "shmlog.h"
 #include "cache.h"
+#include "cache_backend.h"
 #include "vrt.h"
 
 /*--------------------------------------------------------------------*/

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2008-08-21 08:37:37 UTC (rev 3118)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2008-08-21 08:48:29 UTC (rev 3119)
@@ -321,7 +321,7 @@
 	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;




More information about the varnish-commit mailing list