diff options
Diffstat (limited to 'src/datacache/datacache.c')
-rw-r--r-- | src/datacache/datacache.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/src/datacache/datacache.c b/src/datacache/datacache.c index 761ab801f..c93ed58d6 100644 --- a/src/datacache/datacache.c +++ b/src/datacache/datacache.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2015 GNUnet e.V. | 3 | Copyright (C) 2004-2010, 2015, 2022 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -259,26 +259,14 @@ GNUNET_DATACACHE_destroy (struct GNUNET_DATACACHE_Handle *h) | |||
259 | 259 | ||
260 | enum GNUNET_GenericReturnValue | 260 | enum GNUNET_GenericReturnValue |
261 | GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, | 261 | GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, |
262 | const struct GNUNET_HashCode *key, | ||
263 | uint32_t xor_distance, | 262 | uint32_t xor_distance, |
264 | size_t data_size, | 263 | const struct GNUNET_DATACACHE_Block *block) |
265 | const char *data, | ||
266 | enum GNUNET_BLOCK_Type type, | ||
267 | struct GNUNET_TIME_Absolute discard_time, | ||
268 | unsigned int path_info_len, | ||
269 | const struct GNUNET_DHT_PathElement *path_info) | ||
270 | { | 264 | { |
271 | ssize_t used; | 265 | ssize_t used; |
272 | 266 | ||
273 | used = h->api->put (h->api->cls, | 267 | used = h->api->put (h->api->cls, |
274 | key, | ||
275 | xor_distance, | 268 | xor_distance, |
276 | data_size, | 269 | block); |
277 | data, | ||
278 | type, | ||
279 | discard_time, | ||
280 | path_info_len, | ||
281 | path_info); | ||
282 | if (-1 == used) | 270 | if (-1 == used) |
283 | { | 271 | { |
284 | GNUNET_break (0); | 272 | GNUNET_break (0); |
@@ -291,10 +279,10 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, | |||
291 | } | 279 | } |
292 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 280 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
293 | "Stored data under key `%s' in cache\n", | 281 | "Stored data under key `%s' in cache\n", |
294 | GNUNET_h2s (key)); | 282 | GNUNET_h2s (&block->key)); |
295 | if (NULL != h->filter) | 283 | if (NULL != h->filter) |
296 | GNUNET_CONTAINER_bloomfilter_add (h->filter, | 284 | GNUNET_CONTAINER_bloomfilter_add (h->filter, |
297 | key); | 285 | &block->key); |
298 | GNUNET_STATISTICS_update (h->stats, | 286 | GNUNET_STATISTICS_update (h->stats, |
299 | "# bytes stored", | 287 | "# bytes stored", |
300 | used, | 288 | used, |
@@ -325,9 +313,10 @@ GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h, | |||
325 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 313 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
326 | "Processing request for key `%s'\n", | 314 | "Processing request for key `%s'\n", |
327 | GNUNET_h2s (key)); | 315 | GNUNET_h2s (key)); |
328 | if ((NULL != h->filter) && | 316 | if ( (NULL != h->filter) && |
329 | (GNUNET_OK != | 317 | (GNUNET_OK != |
330 | GNUNET_CONTAINER_bloomfilter_test (h->filter, key))) | 318 | GNUNET_CONTAINER_bloomfilter_test (h->filter, |
319 | key)) ) | ||
331 | { | 320 | { |
332 | GNUNET_STATISTICS_update (h->stats, | 321 | GNUNET_STATISTICS_update (h->stats, |
333 | "# requests filtered by bloom filter", | 322 | "# requests filtered by bloom filter", |
@@ -364,7 +353,8 @@ GNUNET_DATACACHE_get_closest (struct GNUNET_DATACACHE_Handle *h, | |||
364 | key, | 353 | key, |
365 | type, | 354 | type, |
366 | num_results, | 355 | num_results, |
367 | iter, iter_cls); | 356 | iter, |
357 | iter_cls); | ||
368 | } | 358 | } |
369 | 359 | ||
370 | 360 | ||