{
struct GNUNET_FS_QueueEntry *qe;
- qe = GNUNET_malloc (sizeof (struct GNUNET_FS_QueueEntry));
+ qe = GNUNET_new (struct GNUNET_FS_QueueEntry);
qe->h = h;
qe->start = start;
qe->stop = stop;
*
* @param cls the 'struct GNUNET_FS_SearchContext*'
* @param filename complete filename (absolute path)
- * @return GNUNET_OK (continue to iterate)
+ * @return #GNUNET_OK (continue to iterate)
*/
static int
deserialize_search_result (void *cls, const char *filename)
uris = NULL;
download = NULL;
update_srch = NULL;
- sr = GNUNET_malloc (sizeof (struct GNUNET_FS_SearchResult));
+ sr = GNUNET_new (struct GNUNET_FS_SearchResult);
sr->h = sc->h;
sr->sc = sc;
sr->serialization = ser;
GNUNET_free (update_srch);
}
GNUNET_break (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_put (sc->master_result_map, &sr->key, sr,
+ GNUNET_CONTAINER_multihashmap_put (sc->master_result_map,
+ &sr->key, sr,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg))
{
*
* @param cls the 'struct GNUNET_FS_DownloadContext*' (parent)
* @param filename complete filename (absolute path)
- * @return GNUNET_OK (continue to iterate)
+ * @return #GNUNET_OK (continue to iterate)
*/
static int
deserialize_subdownload (void *cls, const char *filename)
uris = NULL;
emsg = NULL;
- dc = GNUNET_malloc (sizeof (struct GNUNET_FS_DownloadContext));
+ dc = GNUNET_new (struct GNUNET_FS_DownloadContext);
dc->parent = parent;
dc->h = h;
dc->serialization = GNUNET_strdup (serialization);
}
uris = NULL;
emsg = NULL;
- sc = GNUNET_malloc (sizeof (struct GNUNET_FS_SearchContext));
+ sc = GNUNET_new (struct GNUNET_FS_SearchContext);
if (NULL != psearch_result)
{
sc->psearch_result = psearch_result;
*
* @param cls the 'struct GNUNET_FS_Handle*'
* @param filename complete filename (absolute path)
- * @return GNUNET_OK (continue to iterate)
+ * @return #GNUNET_OK (continue to iterate)
*/
static int
deserialize_search_file (void *cls, const char *filename)
*
* @param cls the 'struct GNUNET_FS_Handle*'
* @param filename complete filename (absolute path)
- * @return GNUNET_OK (continue to iterate)
+ * @return #GNUNET_OK (continue to iterate)
*/
static int
deserialize_download_file (void *cls, const char *filename)
* @return #GNUNET_OK
*/
static int
-search_result_freeze_probes (void *cls, const struct GNUNET_HashCode * key,
+search_result_freeze_probes (void *cls,
+ const struct GNUNET_HashCode *key,
void *value)
{
struct GNUNET_FS_SearchResult *sr = value;
GNUNET_FS_download_signal_suspend_ (sr->download);
sr->download = NULL;
}
- if (NULL != sr->probe_ctx)
- {
- GNUNET_FS_download_stop (sr->probe_ctx, GNUNET_YES);
- sr->probe_ctx = NULL;
- }
- if (GNUNET_SCHEDULER_NO_TASK != sr->probe_ping_task)
- {
- GNUNET_SCHEDULER_cancel (sr->probe_ping_task);
- sr->probe_ping_task = GNUNET_SCHEDULER_NO_TASK;
- }
if (NULL != sr->update_search)
{
GNUNET_FS_search_signal_suspend_ (sr->update_search);
sr->update_search = NULL;
}
+ GNUNET_FS_search_stop_probe_ (sr);
pi.status = GNUNET_FS_STATUS_SEARCH_RESULT_SUSPEND;
pi.value.search.specifics.result_suspend.cctx = sr->client_info;
pi.value.search.specifics.result_suspend.meta = sr->meta;
GNUNET_free_non_null (sr->serialization);
GNUNET_FS_uri_destroy (sr->uri);
GNUNET_CONTAINER_meta_data_destroy (sr->meta);
- if (GNUNET_SCHEDULER_NO_TASK != sr->probe_cancel_task)
- {
- GNUNET_SCHEDULER_cancel (sr->probe_cancel_task);
- sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK;
- }
GNUNET_free_non_null (sr->keyword_bitmap);
GNUNET_free (sr);
return GNUNET_OK;
* Create SUSPEND event for the given search operation
* and then clean up our state (without stop signal).
*
- * @param cls the 'struct GNUNET_FS_SearchContext' to signal for
+ * @param cls the `struct GNUNET_FS_SearchContext` to signal for
*/
void
GNUNET_FS_search_signal_suspend_ (void *cls)
sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc->h, sc);
GNUNET_break (NULL == sc->client_info);
if (sc->task != GNUNET_SCHEDULER_NO_TASK)
+ {
GNUNET_SCHEDULER_cancel (sc->task);
+ sc->task = GNUNET_SCHEDULER_NO_TASK;
+ }
if (NULL != sc->client)
+ {
GNUNET_CLIENT_disconnect (sc->client);
+ sc->client = NULL;
+ }
GNUNET_CONTAINER_multihashmap_destroy (sc->master_result_map);
if (NULL != sc->requests)
{
struct GNUNET_FS_ProgressInfo pi;
if (GNUNET_SCHEDULER_NO_TASK != sc->task)
+ {
GNUNET_SCHEDULER_cancel (sc->task);
- sc->task = GNUNET_SCHEDULER_NO_TASK;
+ sc->task = GNUNET_SCHEDULER_NO_TASK;
+ }
if (NULL != sc->client)
GNUNET_CLIENT_disconnect (sc->client);
sc->client = NULL;
* @param cls the global FS handle
* @param key the key for the search result (unused)
* @param value the search result to free
- * @return GNUNET_OK
+ * @return #GNUNET_OK
*/
static int
-search_result_stop (void *cls, const struct GNUNET_HashCode * key, void *value)
+search_result_stop (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_FS_SearchContext *sc = cls;
struct GNUNET_FS_SearchResult *sr = value;
struct GNUNET_FS_ProgressInfo pi;
GNUNET_FS_search_stop_probe_ (sr);
-
if (NULL != sr->download)
{
sr->download->search = NULL;
* @param cls the global FS handle
* @param key the key for the search result (unused)
* @param value the search result to free
- * @return GNUNET_OK
+ * @return #GNUNET_OK
*/
static int
-search_result_free (void *cls, const struct GNUNET_HashCode * key, void *value)
+search_result_free (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_FS_SearchResult *sr = value;