[PATCH 09/15] Add a BanCompile stevedore callback that the ban code will call when the complete ban lists have been compiled.
Martin Blix Grydeland
martin at varnish-software.com
Wed Nov 7 12:32:12 CET 2012
---
bin/varnishd/cache/cache.h | 1 +
bin/varnishd/cache/cache_ban.c | 5 +++++
bin/varnishd/storage/stevedore.c | 13 +++++++++++++
bin/varnishd/storage/storage.h | 2 ++
4 files changed, 21 insertions(+)
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index f0bba19..40f8388 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -1061,6 +1061,7 @@ void STV_open(void);
void STV_close(void);
void STV_Freestore(struct object *o);
void STV_BanInfo(enum baninfo event, const struct ban *ban);
+void STV_BanCompile(void);
/* storage_synth.c */
struct vsb *SMS_Makesynth(struct object *obj);
diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index 4853be3..1820f94 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -672,6 +672,11 @@ BAN_Compile(void)
/* Notify stevedores */
STV_BanInfo(BI_NEW, ban_magic);
+ /* Notify stevedores that the complete ban lists has been compiled */
+ Lck_Lock(&ban_mtx);
+ STV_BanCompile();
+ Lck_Unlock(&ban_mtx);
+
ban_start = VTAILQ_FIRST(&ban_head);
WRK_BgThread(&ban_thread, "ban-lurker", ban_lurker, NULL);
}
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index 01818b1..1fb803f 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -466,6 +466,19 @@ STV_BanInfo(enum baninfo event, const struct ban *ban)
stv->baninfo(stv, event, ban);
}
+void
+STV_BanCompile(void)
+{
+ struct stevedore *stv;
+
+ VTAILQ_FOREACH(stv, &stv_stevedores, list)
+ if (stv->bancompile != NULL)
+ stv->bancompile(stv);
+ stv = stv_transient;
+ if (stv->bancompile != NULL)
+ stv->bancompile(stv);
+}
+
/*--------------------------------------------------------------------
* VRT functions for stevedores
*/
diff --git a/bin/varnishd/storage/storage.h b/bin/varnishd/storage/storage.h
index f54b8c3..03dc6ce 100644
--- a/bin/varnishd/storage/storage.h
+++ b/bin/varnishd/storage/storage.h
@@ -51,6 +51,7 @@ typedef void storage_close_f(const struct stevedore *);
typedef void storage_signal_close_f(const struct stevedore *);
typedef void storage_baninfo_f(struct stevedore *, enum baninfo event,
const struct ban *ban);
+typedef void storage_bancompile_f(const struct stevedore *);
/* Prototypes for VCL variable responders */
#define VRTSTVTYPE(ct) typedef ct storage_var_##ct(const struct stevedore *);
@@ -75,6 +76,7 @@ struct stevedore {
storage_allocobj_f *allocobj; /* --//-- */
storage_signal_close_f *signal_close; /* --//-- */
storage_baninfo_f *baninfo; /* --//-- */
+ storage_bancompile_f *bancompile; /* --//-- */
struct lru *lru;
--
1.7.9.5
More information about the varnish-dev
mailing list