X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=cache.c;fp=cache.c;h=b668d3338730612f646951ac90a9c44f676764bb;hb=ad1f9d3725a300f10eca071c6fe2f2c583f51436;hp=9025d1d76e7924a19cd18d60eec757495982319d;hpb=c8dd2dc8f91a322178c43281cbc5c8fc16da5219;p=catta 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); }