aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_sharetree.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-29 15:48:23 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-29 15:48:23 +0000
commit415c958a01ab6dac73b0109becbe8657b525af9c (patch)
tree27681936603f7aaaf019d3646def34be58c524ff /src/fs/fs_sharetree.c
parent09cc5834ba81348ce8d97ed6889204ad8d45150e (diff)
downloadgnunet-415c958a01ab6dac73b0109becbe8657b525af9c.tar.gz
gnunet-415c958a01ab6dac73b0109becbe8657b525af9c.zip
-misc bugfixes
Diffstat (limited to 'src/fs/fs_sharetree.c')
-rw-r--r--src/fs/fs_sharetree.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/fs/fs_sharetree.c b/src/fs/fs_sharetree.c
index 6c9642b9b..8660c8958 100644
--- a/src/fs/fs_sharetree.c
+++ b/src/fs/fs_sharetree.c
@@ -274,7 +274,12 @@ migrate_and_drop_keywords (void *cls, const GNUNET_HashCode * key, void *value)
274 struct KeywordCounter *counter = value; 274 struct KeywordCounter *counter = value;
275 275
276 if (counter->count >= tc->move_threshold) 276 if (counter->count >= tc->move_threshold)
277 GNUNET_FS_uri_ksk_add_keyword (tc->pos->ksk_uri, counter->value, GNUNET_NO); 277 {
278 if (NULL == tc->pos->ksk_uri)
279 tc->pos->ksk_uri = GNUNET_FS_uri_ksk_create_from_args (1, &counter->value);
280 else
281 GNUNET_FS_uri_ksk_add_keyword (tc->pos->ksk_uri, counter->value, GNUNET_NO);
282 }
278 GNUNET_assert (GNUNET_YES == 283 GNUNET_assert (GNUNET_YES ==
279 GNUNET_CONTAINER_multihashmap_remove (tc->keywordcounter, 284 GNUNET_CONTAINER_multihashmap_remove (tc->keywordcounter,
280 key, 285 key,
@@ -360,7 +365,8 @@ share_tree_trim (struct TrimContext *tc,
360 for (pos = tree->children_head; NULL != pos; pos = pos->next) 365 for (pos = tree->children_head; NULL != pos; pos = pos->next)
361 { 366 {
362 GNUNET_CONTAINER_meta_data_iterate (pos->meta, &add_to_meta_counter, tc->metacounter); 367 GNUNET_CONTAINER_meta_data_iterate (pos->meta, &add_to_meta_counter, tc->metacounter);
363 GNUNET_FS_uri_ksk_get_keywords (pos->ksk_uri, &add_to_keyword_counter, tc->keywordcounter); 368 if (NULL != pos->ksk_uri)
369 GNUNET_FS_uri_ksk_get_keywords (pos->ksk_uri, &add_to_keyword_counter, tc->keywordcounter);
364 } 370 }
365 371
366 /* calculate threshold for moving keywords / meta data */ 372 /* calculate threshold for moving keywords / meta data */
@@ -370,7 +376,8 @@ share_tree_trim (struct TrimContext *tc,
370 for (pos = tree->children_head; NULL != pos; pos = pos->next) 376 for (pos = tree->children_head; NULL != pos; pos = pos->next)
371 { 377 {
372 tc->pos = pos; 378 tc->pos = pos;
373 GNUNET_FS_uri_ksk_get_keywords (pos->ksk_uri, &remove_high_frequency_keywords, tc); 379 if (NULL != pos->ksk_uri)
380 GNUNET_FS_uri_ksk_get_keywords (pos->ksk_uri, &remove_high_frequency_keywords, tc);
374 } 381 }
375 382
376 /* add high-frequency meta data and keywords to parent */ 383 /* add high-frequency meta data and keywords to parent */