diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-24 12:22:54 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-24 12:22:54 +0000 |
commit | 9f55be0f1ed0fe873344ef165bf0b23698749d07 (patch) | |
tree | f4ff5ca0077b4aab16c200a6abdc7aeaca1215f5 /src/datacache | |
parent | 1156b9092305da331de475284321e769492a1ba6 (diff) | |
download | gnunet-9f55be0f1ed0fe873344ef165bf0b23698749d07.tar.gz gnunet-9f55be0f1ed0fe873344ef165bf0b23698749d07.zip |
more logging
Diffstat (limited to 'src/datacache')
-rw-r--r-- | src/datacache/datacache.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/datacache/datacache.c b/src/datacache/datacache.c index 51d5d3423..c83199f09 100644 --- a/src/datacache/datacache.c +++ b/src/datacache/datacache.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include "gnunet_statistics_service.h" | 29 | #include "gnunet_statistics_service.h" |
30 | #include "gnunet_datacache_plugin.h" | 30 | #include "gnunet_datacache_plugin.h" |
31 | 31 | ||
32 | #define DEBUG_DATACACHE GNUNET_EXTRA_LOGGING | ||
33 | |||
32 | #define LOG(kind,...) GNUNET_log_from (kind, "datacache", __VA_ARGS__) | 34 | #define LOG(kind,...) GNUNET_log_from (kind, "datacache", __VA_ARGS__) |
33 | 35 | ||
34 | /** | 36 | /** |
@@ -104,6 +106,11 @@ env_delete_notify (void *cls, const GNUNET_HashCode * key, size_t size) | |||
104 | { | 106 | { |
105 | struct GNUNET_DATACACHE_Handle *h = cls; | 107 | struct GNUNET_DATACACHE_Handle *h = cls; |
106 | 108 | ||
109 | #if DEBUG_DATACACHE | ||
110 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
111 | "Content under key `%s' discarded\n", | ||
112 | GNUNET_h2s (key)); | ||
113 | #endif | ||
107 | GNUNET_assert (h->utilization >= size); | 114 | GNUNET_assert (h->utilization >= size); |
108 | h->utilization -= size; | 115 | h->utilization -= size; |
109 | GNUNET_CONTAINER_bloomfilter_remove (h->filter, key); | 116 | GNUNET_CONTAINER_bloomfilter_remove (h->filter, key); |
@@ -227,12 +234,18 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, | |||
227 | { | 234 | { |
228 | uint32_t used; | 235 | uint32_t used; |
229 | 236 | ||
237 | |||
230 | used = h->api->put (h->api->cls, key, size, data, type, discard_time); | 238 | used = h->api->put (h->api->cls, key, size, data, type, discard_time); |
231 | if (used == 0) | 239 | if (used == 0) |
232 | { | 240 | { |
233 | GNUNET_break (0); | 241 | GNUNET_break (0); |
234 | return GNUNET_SYSERR; | 242 | return GNUNET_SYSERR; |
235 | } | 243 | } |
244 | #if DEBUG_DATACACHE | ||
245 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
246 | "Stored data under key `%s' in cache\n", | ||
247 | GNUNET_h2s (key)); | ||
248 | #endif | ||
236 | GNUNET_STATISTICS_update (h->stats, gettext_noop ("# bytes stored"), size, | 249 | GNUNET_STATISTICS_update (h->stats, gettext_noop ("# bytes stored"), size, |
237 | GNUNET_NO); | 250 | GNUNET_NO); |
238 | GNUNET_CONTAINER_bloomfilter_add (h->filter, key); | 251 | GNUNET_CONTAINER_bloomfilter_add (h->filter, key); |
@@ -261,12 +274,22 @@ GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h, | |||
261 | { | 274 | { |
262 | GNUNET_STATISTICS_update (h->stats, gettext_noop ("# requests received"), 1, | 275 | GNUNET_STATISTICS_update (h->stats, gettext_noop ("# requests received"), 1, |
263 | GNUNET_NO); | 276 | GNUNET_NO); |
277 | #if DEBUG_DATACACHE | ||
278 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
279 | "Processing request for key `%s'\n", | ||
280 | GNUNET_h2s (key)); | ||
281 | #endif | ||
264 | if (GNUNET_OK != GNUNET_CONTAINER_bloomfilter_test (h->filter, key)) | 282 | if (GNUNET_OK != GNUNET_CONTAINER_bloomfilter_test (h->filter, key)) |
265 | { | 283 | { |
266 | GNUNET_STATISTICS_update (h->stats, | 284 | GNUNET_STATISTICS_update (h->stats, |
267 | gettext_noop | 285 | gettext_noop |
268 | ("# requests filtered by bloom filter"), 1, | 286 | ("# requests filtered by bloom filter"), 1, |
269 | GNUNET_NO); | 287 | GNUNET_NO); |
288 | #if DEBUG_DATACACHE | ||
289 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
290 | "Bloomfilter filters request for key `%s'\n", | ||
291 | GNUNET_h2s (key)); | ||
292 | #endif | ||
270 | return 0; /* can not be present */ | 293 | return 0; /* can not be present */ |
271 | } | 294 | } |
272 | return h->api->get (h->api->cls, key, type, iter, iter_cls); | 295 | return h->api->get (h->api->cls, key, type, iter, iter_cls); |