From ad1f9d3725a300f10eca071c6fe2f2c583f51436 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 25 Mar 2005 21:52:55 +0000 Subject: * add announcing/goodbye * add cache maintaince * fix a bug in prioq.c git-svn-id: file:///home/lennart/svn/public/avahi/trunk@16 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- cache.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'cache.c') diff --git a/cache.c b/cache.c index 9025d1d..b668d33 100644 --- a/cache.c +++ b/cache.c @@ -6,6 +6,8 @@ static void remove_entry(flxCache *c, flxCacheEntry *e, gboolean remove_from_has g_assert(c); g_assert(e); + g_message("remvoin from cache: %p %p", c, e); + if (remove_from_hash_table) { flxCacheEntry *t; t = g_hash_table_lookup(c->hash_table, e->record->key); @@ -24,14 +26,13 @@ static void remove_entry(flxCache *c, flxCacheEntry *e, gboolean remove_from_has g_free(e); } -flxCache *flx_cache_new(flxServer *server, flxInterface *iface, guchar protocol) { +flxCache *flx_cache_new(flxServer *server, flxInterface *iface) { flxCache *c; g_assert(server); c = g_new(flxCache, 1); c->server = server; c->interface = iface; - c->protocol = protocol; c->hash_table = g_hash_table_new((GHashFunc) flx_key_hash, (GEqualFunc) flx_key_equal); return c; @@ -119,7 +120,7 @@ static void elapse_func(flxTimeEvent *t, void *userdata) { g_message("Requesting cache entry update at %i%%.", percent); /* Request a cache update */ - flx_interface_post_query(e->cache->interface, e->cache->protocol, e->record->key); + flx_interface_post_query(e->cache->interface, e->record->key); /* Check again later */ next_expiry(e->cache, e, percent); @@ -232,15 +233,10 @@ void flx_cache_drop_record(flxCache *c, flxRecord *r) { static void func(gpointer key, gpointer data, gpointer userdata) { flxCacheEntry *e = data; flxKey *k = key; + gchar *t; - gchar *s, *t; - - s = flx_key_to_string(k); t = flx_record_to_string(e->record); - - fprintf((FILE*) userdata, "%s %s\n", s, t); - - g_free(s); + fprintf((FILE*) userdata, "%s\n", t); g_free(t); } -- cgit