diff options
Diffstat (limited to 'src/datacache/plugin_datacache_heap.c')
-rw-r--r-- | src/datacache/plugin_datacache_heap.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/datacache/plugin_datacache_heap.c b/src/datacache/plugin_datacache_heap.c index fbd3aea9a..2756315fb 100644 --- a/src/datacache/plugin_datacache_heap.c +++ b/src/datacache/plugin_datacache_heap.c | |||
@@ -409,6 +409,8 @@ struct GetClosestContext | |||
409 | { | 409 | { |
410 | struct Value **values; | 410 | struct Value **values; |
411 | 411 | ||
412 | enum GNUNET_BLOCK_Type type; | ||
413 | |||
412 | unsigned int num_results; | 414 | unsigned int num_results; |
413 | 415 | ||
414 | const struct GNUNET_HashCode *key; | 416 | const struct GNUNET_HashCode *key; |
@@ -427,6 +429,9 @@ find_closest (void *cls, | |||
427 | if (1 != GNUNET_CRYPTO_hash_cmp (key, | 429 | if (1 != GNUNET_CRYPTO_hash_cmp (key, |
428 | gcc->key)) | 430 | gcc->key)) |
429 | return GNUNET_OK; /* useless */ | 431 | return GNUNET_OK; /* useless */ |
432 | if ( (val->type != gcc->type) && | ||
433 | (GNUNET_BLOCK_TYPE_ANY != gcc->type) ) | ||
434 | return GNUNET_OK; /* useless */ | ||
430 | j = gcc->num_results; | 435 | j = gcc->num_results; |
431 | for (unsigned int i = 0; i < gcc->num_results; i++) | 436 | for (unsigned int i = 0; i < gcc->num_results; i++) |
432 | { | 437 | { |
@@ -457,6 +462,7 @@ find_closest (void *cls, | |||
457 | * | 462 | * |
458 | * @param cls closure (internal context for the plugin) | 463 | * @param cls closure (internal context for the plugin) |
459 | * @param key area of the keyspace to look into | 464 | * @param key area of the keyspace to look into |
465 | * @param type desired block type for the replies | ||
460 | * @param num_results number of results that should be returned to @a iter | 466 | * @param num_results number of results that should be returned to @a iter |
461 | * @param iter maybe NULL (to just count) | 467 | * @param iter maybe NULL (to just count) |
462 | * @param iter_cls closure for @a iter | 468 | * @param iter_cls closure for @a iter |
@@ -465,6 +471,7 @@ find_closest (void *cls, | |||
465 | static unsigned int | 471 | static unsigned int |
466 | heap_plugin_get_closest (void *cls, | 472 | heap_plugin_get_closest (void *cls, |
467 | const struct GNUNET_HashCode *key, | 473 | const struct GNUNET_HashCode *key, |
474 | enum GNUNET_BLOCK_Type type, | ||
468 | unsigned int num_results, | 475 | unsigned int num_results, |
469 | GNUNET_DATACACHE_Iterator iter, | 476 | GNUNET_DATACACHE_Iterator iter, |
470 | void *iter_cls) | 477 | void *iter_cls) |
@@ -473,6 +480,7 @@ heap_plugin_get_closest (void *cls, | |||
473 | struct Value *values[num_results]; | 480 | struct Value *values[num_results]; |
474 | struct GetClosestContext gcc = { | 481 | struct GetClosestContext gcc = { |
475 | .values = values, | 482 | .values = values, |
483 | .type = type, | ||
476 | .num_results = num_results, | 484 | .num_results = num_results, |
477 | .key = key | 485 | .key = key |
478 | }; | 486 | }; |