diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-03-05 00:18:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-03-05 00:18:35 +0000 |
commit | 95eb80f56591ba9dfab35b97ba11088a355ef58b (patch) | |
tree | 1db0f5e5ad8301cd7254df45952b3c3d9c48c7ca /src/fs/fs_search.c | |
parent | 0e5925b81384b8a8b12d950f23ff878d280a46a5 (diff) | |
download | gnunet-95eb80f56591ba9dfab35b97ba11088a355ef58b.tar.gz gnunet-95eb80f56591ba9dfab35b97ba11088a355ef58b.zip |
-misc bugfixes
Diffstat (limited to 'src/fs/fs_search.c')
-rw-r--r-- | src/fs/fs_search.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index b2ccc0e16..5beac0d73 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c | |||
@@ -1443,6 +1443,30 @@ GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc) | |||
1443 | 1443 | ||
1444 | 1444 | ||
1445 | /** | 1445 | /** |
1446 | * Signal stop for the given search result. | ||
1447 | * | ||
1448 | * @param cls the global FS handle | ||
1449 | * @param key the key for the search result (unused) | ||
1450 | * @param value the search result to free | ||
1451 | * @return GNUNET_OK | ||
1452 | */ | ||
1453 | static int | ||
1454 | search_result_stop (void *cls, const GNUNET_HashCode * key, void *value) | ||
1455 | { | ||
1456 | struct GNUNET_FS_SearchContext *sc = cls; | ||
1457 | struct GNUNET_FS_SearchResult *sr = value; | ||
1458 | struct GNUNET_FS_ProgressInfo pi; | ||
1459 | |||
1460 | pi.status = GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED; | ||
1461 | pi.value.search.specifics.result_stopped.cctx = sr->client_info; | ||
1462 | pi.value.search.specifics.result_stopped.meta = sr->meta; | ||
1463 | pi.value.search.specifics.result_stopped.uri = sr->uri; | ||
1464 | sr->client_info = GNUNET_FS_search_make_status_ (&pi, sc); | ||
1465 | return GNUNET_OK; | ||
1466 | } | ||
1467 | |||
1468 | |||
1469 | /** | ||
1446 | * Free the given search result. | 1470 | * Free the given search result. |
1447 | * | 1471 | * |
1448 | * @param cls the global FS handle | 1472 | * @param cls the global FS handle |
@@ -1480,11 +1504,6 @@ search_result_free (void *cls, const GNUNET_HashCode * key, void *value) | |||
1480 | GNUNET_FS_search_stop (sr->update_search); | 1504 | GNUNET_FS_search_stop (sr->update_search); |
1481 | GNUNET_assert (sr->update_search == NULL); | 1505 | GNUNET_assert (sr->update_search == NULL); |
1482 | } | 1506 | } |
1483 | pi.status = GNUNET_FS_STATUS_SEARCH_RESULT_STOPPED; | ||
1484 | pi.value.search.specifics.result_stopped.cctx = sr->client_info; | ||
1485 | pi.value.search.specifics.result_stopped.meta = sr->meta; | ||
1486 | pi.value.search.specifics.result_stopped.uri = sr->uri; | ||
1487 | sr->client_info = GNUNET_FS_search_make_status_ (&pi, sc); | ||
1488 | GNUNET_break (NULL == sr->client_info); | 1507 | GNUNET_break (NULL == sr->client_info); |
1489 | GNUNET_free_non_null (sr->serialization); | 1508 | GNUNET_free_non_null (sr->serialization); |
1490 | GNUNET_FS_uri_destroy (sr->uri); | 1509 | GNUNET_FS_uri_destroy (sr->uri); |
@@ -1512,6 +1531,8 @@ GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc) | |||
1512 | 1531 | ||
1513 | if (sc->top != NULL) | 1532 | if (sc->top != NULL) |
1514 | GNUNET_FS_end_top (sc->h, sc->top); | 1533 | GNUNET_FS_end_top (sc->h, sc->top); |
1534 | GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map, | ||
1535 | &search_result_stop, sc); | ||
1515 | if (sc->psearch_result != NULL) | 1536 | if (sc->psearch_result != NULL) |
1516 | sc->psearch_result->update_search = NULL; | 1537 | sc->psearch_result->update_search = NULL; |
1517 | if (sc->serialization != NULL) | 1538 | if (sc->serialization != NULL) |