aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-11-05 22:19:43 +0000
committerChristian Grothoff <christian@grothoff.org>2013-11-05 22:19:43 +0000
commit632a0bd9d3f244f26c242ee200b0b3a31a7f68df (patch)
tree2e5821c0eb5acca0231d78e1316a06a9d80032f0 /src/fs
parent3c6b67f3282836765bc837fefbc600f7dbe23465 (diff)
downloadgnunet-632a0bd9d3f244f26c242ee200b0b3a31a7f68df.tar.gz
gnunet-632a0bd9d3f244f26c242ee200b0b3a31a7f68df.zip
-stylistic fixes
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/fs_api.c19
-rw-r--r--src/fs/fs_download.c4
-rw-r--r--src/fs/fs_search.c44
3 files changed, 33 insertions, 34 deletions
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index 88d82158e..72d5eab15 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -313,7 +313,7 @@ GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, GNUNET_FS_QueueStart start,
313{ 313{
314 struct GNUNET_FS_QueueEntry *qe; 314 struct GNUNET_FS_QueueEntry *qe;
315 315
316 qe = GNUNET_malloc (sizeof (struct GNUNET_FS_QueueEntry)); 316 qe = GNUNET_new (struct GNUNET_FS_QueueEntry);
317 qe->h = h; 317 qe->h = h;
318 qe->start = start; 318 qe->start = start;
319 qe->stop = stop; 319 qe->stop = stop;
@@ -2298,7 +2298,7 @@ deserialize_search (struct GNUNET_FS_Handle *h,
2298 * 2298 *
2299 * @param cls the 'struct GNUNET_FS_SearchContext*' 2299 * @param cls the 'struct GNUNET_FS_SearchContext*'
2300 * @param filename complete filename (absolute path) 2300 * @param filename complete filename (absolute path)
2301 * @return GNUNET_OK (continue to iterate) 2301 * @return #GNUNET_OK (continue to iterate)
2302 */ 2302 */
2303static int 2303static int
2304deserialize_search_result (void *cls, const char *filename) 2304deserialize_search_result (void *cls, const char *filename)
@@ -2332,7 +2332,7 @@ deserialize_search_result (void *cls, const char *filename)
2332 uris = NULL; 2332 uris = NULL;
2333 download = NULL; 2333 download = NULL;
2334 update_srch = NULL; 2334 update_srch = NULL;
2335 sr = GNUNET_malloc (sizeof (struct GNUNET_FS_SearchResult)); 2335 sr = GNUNET_new (struct GNUNET_FS_SearchResult);
2336 sr->h = sc->h; 2336 sr->h = sc->h;
2337 sr->sc = sc; 2337 sr->sc = sc;
2338 sr->serialization = ser; 2338 sr->serialization = ser;
@@ -2398,7 +2398,8 @@ deserialize_search_result (void *cls, const char *filename)
2398 GNUNET_free (update_srch); 2398 GNUNET_free (update_srch);
2399 } 2399 }
2400 GNUNET_break (GNUNET_YES == 2400 GNUNET_break (GNUNET_YES ==
2401 GNUNET_CONTAINER_multihashmap_put (sc->master_result_map, &sr->key, sr, 2401 GNUNET_CONTAINER_multihashmap_put (sc->master_result_map,
2402 &sr->key, sr,
2402 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); 2403 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
2403 if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg)) 2404 if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg))
2404 { 2405 {
@@ -2588,7 +2589,7 @@ free_search_context (struct GNUNET_FS_SearchContext *sc)
2588 * 2589 *
2589 * @param cls the 'struct GNUNET_FS_DownloadContext*' (parent) 2590 * @param cls the 'struct GNUNET_FS_DownloadContext*' (parent)
2590 * @param filename complete filename (absolute path) 2591 * @param filename complete filename (absolute path)
2591 * @return GNUNET_OK (continue to iterate) 2592 * @return #GNUNET_OK (continue to iterate)
2592 */ 2593 */
2593static int 2594static int
2594deserialize_subdownload (void *cls, const char *filename) 2595deserialize_subdownload (void *cls, const char *filename)
@@ -2678,7 +2679,7 @@ deserialize_download (struct GNUNET_FS_Handle *h,
2678 2679
2679 uris = NULL; 2680 uris = NULL;
2680 emsg = NULL; 2681 emsg = NULL;
2681 dc = GNUNET_malloc (sizeof (struct GNUNET_FS_DownloadContext)); 2682 dc = GNUNET_new (struct GNUNET_FS_DownloadContext);
2682 dc->parent = parent; 2683 dc->parent = parent;
2683 dc->h = h; 2684 dc->h = h;
2684 dc->serialization = GNUNET_strdup (serialization); 2685 dc->serialization = GNUNET_strdup (serialization);
@@ -2807,7 +2808,7 @@ deserialize_search (struct GNUNET_FS_Handle *h,
2807 } 2808 }
2808 uris = NULL; 2809 uris = NULL;
2809 emsg = NULL; 2810 emsg = NULL;
2810 sc = GNUNET_malloc (sizeof (struct GNUNET_FS_SearchContext)); 2811 sc = GNUNET_new (struct GNUNET_FS_SearchContext);
2811 if (NULL != psearch_result) 2812 if (NULL != psearch_result)
2812 { 2813 {
2813 sc->psearch_result = psearch_result; 2814 sc->psearch_result = psearch_result;
@@ -2868,7 +2869,7 @@ cleanup:
2868 * 2869 *
2869 * @param cls the 'struct GNUNET_FS_Handle*' 2870 * @param cls the 'struct GNUNET_FS_Handle*'
2870 * @param filename complete filename (absolute path) 2871 * @param filename complete filename (absolute path)
2871 * @return GNUNET_OK (continue to iterate) 2872 * @return #GNUNET_OK (continue to iterate)
2872 */ 2873 */
2873static int 2874static int
2874deserialize_search_file (void *cls, const char *filename) 2875deserialize_search_file (void *cls, const char *filename)
@@ -2919,7 +2920,7 @@ deserialize_search_file (void *cls, const char *filename)
2919 * 2920 *
2920 * @param cls the 'struct GNUNET_FS_Handle*' 2921 * @param cls the 'struct GNUNET_FS_Handle*'
2921 * @param filename complete filename (absolute path) 2922 * @param filename complete filename (absolute path)
2922 * @return GNUNET_OK (continue to iterate) 2923 * @return #GNUNET_OK (continue to iterate)
2923 */ 2924 */
2924static int 2925static int
2925deserialize_download_file (void *cls, const char *filename) 2926deserialize_download_file (void *cls, const char *filename)
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c
index 070be0106..997d42e18 100644
--- a/src/fs/fs_download.c
+++ b/src/fs/fs_download.c
@@ -934,7 +934,7 @@ GNUNET_FS_free_download_request_ (struct DownloadRequest *dr)
934 * @param cls closure (our 'struct ProcessResultClosure') 934 * @param cls closure (our 'struct ProcessResultClosure')
935 * @param key query for the given value / request 935 * @param key query for the given value / request
936 * @param value value in the hash map (a 'struct DownloadRequest') 936 * @param value value in the hash map (a 'struct DownloadRequest')
937 * @return GNUNET_YES (we should continue to iterate); unless serious error 937 * @return #GNUNET_YES (we should continue to iterate); unless serious error
938 */ 938 */
939static int 939static int
940process_result_with_request (void *cls, const struct GNUNET_HashCode * key, 940process_result_with_request (void *cls, const struct GNUNET_HashCode * key,
@@ -1492,7 +1492,7 @@ activate_fs_download (void *cls, struct GNUNET_CLIENT_Connection *client)
1492/** 1492/**
1493 * We must stop to ask the FS service for our blocks. Pause the download. 1493 * We must stop to ask the FS service for our blocks. Pause the download.
1494 * 1494 *
1495 * @param cls the 'struct GNUNET_FS_DownloadContext' 1495 * @param cls the `struct GNUNET_FS_DownloadContext`
1496 */ 1496 */
1497static void 1497static void
1498deactivate_fs_download (void *cls) 1498deactivate_fs_download (void *cls)
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c
index fe99a9cf9..52bc4aca0 100644
--- a/src/fs/fs_search.c
+++ b/src/fs/fs_search.c
@@ -1326,7 +1326,8 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc)
1326 * @return #GNUNET_OK 1326 * @return #GNUNET_OK
1327 */ 1327 */
1328static int 1328static int
1329search_result_freeze_probes (void *cls, const struct GNUNET_HashCode * key, 1329search_result_freeze_probes (void *cls,
1330 const struct GNUNET_HashCode *key,
1330 void *value) 1331 void *value)
1331{ 1332{
1332 struct GNUNET_FS_SearchResult *sr = value; 1333 struct GNUNET_FS_SearchResult *sr = value;
@@ -1396,21 +1397,12 @@ search_result_suspend (void *cls,
1396 GNUNET_FS_download_signal_suspend_ (sr->download); 1397 GNUNET_FS_download_signal_suspend_ (sr->download);
1397 sr->download = NULL; 1398 sr->download = NULL;
1398 } 1399 }
1399 if (NULL != sr->probe_ctx)
1400 {
1401 GNUNET_FS_download_stop (sr->probe_ctx, GNUNET_YES);
1402 sr->probe_ctx = NULL;
1403 }
1404 if (GNUNET_SCHEDULER_NO_TASK != sr->probe_ping_task)
1405 {
1406 GNUNET_SCHEDULER_cancel (sr->probe_ping_task);
1407 sr->probe_ping_task = GNUNET_SCHEDULER_NO_TASK;
1408 }
1409 if (NULL != sr->update_search) 1400 if (NULL != sr->update_search)
1410 { 1401 {
1411 GNUNET_FS_search_signal_suspend_ (sr->update_search); 1402 GNUNET_FS_search_signal_suspend_ (sr->update_search);
1412 sr->update_search = NULL; 1403 sr->update_search = NULL;
1413 } 1404 }
1405 GNUNET_FS_search_stop_probe_ (sr);
1414 pi.status = GNUNET_FS_STATUS_SEARCH_RESULT_SUSPEND; 1406 pi.status = GNUNET_FS_STATUS_SEARCH_RESULT_SUSPEND;
1415 pi.value.search.specifics.result_suspend.cctx = sr->client_info; 1407 pi.value.search.specifics.result_suspend.cctx = sr->client_info;
1416 pi.value.search.specifics.result_suspend.meta = sr->meta; 1408 pi.value.search.specifics.result_suspend.meta = sr->meta;
@@ -1420,11 +1412,6 @@ search_result_suspend (void *cls,
1420 GNUNET_free_non_null (sr->serialization); 1412 GNUNET_free_non_null (sr->serialization);
1421 GNUNET_FS_uri_destroy (sr->uri); 1413 GNUNET_FS_uri_destroy (sr->uri);
1422 GNUNET_CONTAINER_meta_data_destroy (sr->meta); 1414 GNUNET_CONTAINER_meta_data_destroy (sr->meta);
1423 if (GNUNET_SCHEDULER_NO_TASK != sr->probe_cancel_task)
1424 {
1425 GNUNET_SCHEDULER_cancel (sr->probe_cancel_task);
1426 sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK;
1427 }
1428 GNUNET_free_non_null (sr->keyword_bitmap); 1415 GNUNET_free_non_null (sr->keyword_bitmap);
1429 GNUNET_free (sr); 1416 GNUNET_free (sr);
1430 return GNUNET_OK; 1417 return GNUNET_OK;
@@ -1435,7 +1422,7 @@ search_result_suspend (void *cls,
1435 * Create SUSPEND event for the given search operation 1422 * Create SUSPEND event for the given search operation
1436 * and then clean up our state (without stop signal). 1423 * and then clean up our state (without stop signal).
1437 * 1424 *
1438 * @param cls the 'struct GNUNET_FS_SearchContext' to signal for 1425 * @param cls the `struct GNUNET_FS_SearchContext` to signal for
1439 */ 1426 */
1440void 1427void
1441GNUNET_FS_search_signal_suspend_ (void *cls) 1428GNUNET_FS_search_signal_suspend_ (void *cls)
@@ -1451,9 +1438,15 @@ GNUNET_FS_search_signal_suspend_ (void *cls)
1451 sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc->h, sc); 1438 sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc->h, sc);
1452 GNUNET_break (NULL == sc->client_info); 1439 GNUNET_break (NULL == sc->client_info);
1453 if (sc->task != GNUNET_SCHEDULER_NO_TASK) 1440 if (sc->task != GNUNET_SCHEDULER_NO_TASK)
1441 {
1454 GNUNET_SCHEDULER_cancel (sc->task); 1442 GNUNET_SCHEDULER_cancel (sc->task);
1443 sc->task = GNUNET_SCHEDULER_NO_TASK;
1444 }
1455 if (NULL != sc->client) 1445 if (NULL != sc->client)
1446 {
1456 GNUNET_CLIENT_disconnect (sc->client); 1447 GNUNET_CLIENT_disconnect (sc->client);
1448 sc->client = NULL;
1449 }
1457 GNUNET_CONTAINER_multihashmap_destroy (sc->master_result_map); 1450 GNUNET_CONTAINER_multihashmap_destroy (sc->master_result_map);
1458 if (NULL != sc->requests) 1451 if (NULL != sc->requests)
1459 { 1452 {
@@ -1509,8 +1502,10 @@ GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc)
1509 struct GNUNET_FS_ProgressInfo pi; 1502 struct GNUNET_FS_ProgressInfo pi;
1510 1503
1511 if (GNUNET_SCHEDULER_NO_TASK != sc->task) 1504 if (GNUNET_SCHEDULER_NO_TASK != sc->task)
1505 {
1512 GNUNET_SCHEDULER_cancel (sc->task); 1506 GNUNET_SCHEDULER_cancel (sc->task);
1513 sc->task = GNUNET_SCHEDULER_NO_TASK; 1507 sc->task = GNUNET_SCHEDULER_NO_TASK;
1508 }
1514 if (NULL != sc->client) 1509 if (NULL != sc->client)
1515 GNUNET_CLIENT_disconnect (sc->client); 1510 GNUNET_CLIENT_disconnect (sc->client);
1516 sc->client = NULL; 1511 sc->client = NULL;
@@ -1549,17 +1544,18 @@ GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc)
1549 * @param cls the global FS handle 1544 * @param cls the global FS handle
1550 * @param key the key for the search result (unused) 1545 * @param key the key for the search result (unused)
1551 * @param value the search result to free 1546 * @param value the search result to free
1552 * @return GNUNET_OK 1547 * @return #GNUNET_OK
1553 */ 1548 */
1554static int 1549static int
1555search_result_stop (void *cls, const struct GNUNET_HashCode * key, void *value) 1550search_result_stop (void *cls,
1551 const struct GNUNET_HashCode *key,
1552 void *value)
1556{ 1553{
1557 struct GNUNET_FS_SearchContext *sc = cls; 1554 struct GNUNET_FS_SearchContext *sc = cls;
1558 struct GNUNET_FS_SearchResult *sr = value; 1555 struct GNUNET_FS_SearchResult *sr = value;
1559 struct GNUNET_FS_ProgressInfo pi; 1556 struct GNUNET_FS_ProgressInfo pi;
1560 1557
1561 GNUNET_FS_search_stop_probe_ (sr); 1558 GNUNET_FS_search_stop_probe_ (sr);
1562
1563 if (NULL != sr->download) 1559 if (NULL != sr->download)
1564 { 1560 {
1565 sr->download->search = NULL; 1561 sr->download->search = NULL;
@@ -1593,10 +1589,12 @@ search_result_stop (void *cls, const struct GNUNET_HashCode * key, void *value)
1593 * @param cls the global FS handle 1589 * @param cls the global FS handle
1594 * @param key the key for the search result (unused) 1590 * @param key the key for the search result (unused)
1595 * @param value the search result to free 1591 * @param value the search result to free
1596 * @return GNUNET_OK 1592 * @return #GNUNET_OK
1597 */ 1593 */
1598static int 1594static int
1599search_result_free (void *cls, const struct GNUNET_HashCode * key, void *value) 1595search_result_free (void *cls,
1596 const struct GNUNET_HashCode *key,
1597 void *value)
1600{ 1598{
1601 struct GNUNET_FS_SearchResult *sr = value; 1599 struct GNUNET_FS_SearchResult *sr = value;
1602 1600