return NULL;
}
ret = GNUNET_malloc (sizeof (struct GNUNET_FS_FileInformation));
+ ret->h = h;
ksks = NULL;
chks = NULL;
filename = NULL;
GNUNET_free (emsg);
}
GNUNET_free_non_null (ns);
+ pc->top = GNUNET_FS_make_top (h, &GNUNET_FS_publish_signal_suspend_, pc);
return GNUNET_OK;
cleanup:
GNUNET_free_non_null (pc->nid);
GNUNET_break (0);
goto cleanup;
}
+ uc->top = GNUNET_FS_make_top (h,
+ &GNUNET_FS_unindex_signal_suspend_,
+ uc);
pi.status = GNUNET_FS_STATUS_UNINDEX_RESUME;
pi.value.unindex.specifics.resume.message = uc->emsg;
GNUNET_FS_unindex_make_status_ (&pi,
dc->search = search;
search->download = dc;
}
- signal_download_resume (dc);
+ if ( (parent == NULL) ||
+ (search == NULL) )
+ dc->top = GNUNET_FS_make_top (dc->h,
+ &GNUNET_FS_download_signal_suspend_,
+ dc);
+ signal_download_resume (dc);
GNUNET_free (uris);
return;
cleanup:
char *ser;
char *emsg;
struct GNUNET_BIO_ReadHandle *rh;
+ struct GNUNET_FS_SearchContext *sc;
ser = get_serialization_short_name (filename);
rh = GNUNET_BIO_read_open (filename);
}
return GNUNET_OK;
}
- (void) deserialize_search (h, rh, NULL, ser);
+ sc = deserialize_search (h, rh, NULL, ser);
+ sc->top = GNUNET_FS_make_top (h, &GNUNET_FS_search_signal_suspend_, sc);
GNUNET_free (ser);
if (GNUNET_OK !=
GNUNET_BIO_read_close (rh, &emsg))
void
GNUNET_FS_download_sync_ (struct GNUNET_FS_DownloadContext *dc);
+/**
+ * Create SUSPEND event for the given publish operation
+ * and then clean up our state (without stop signal).
+ *
+ * @param cls the 'struct GNUNET_FS_PublishContext' to signal for
+ */
+void
+GNUNET_FS_publish_signal_suspend_ (void *cls);
+
+/**
+ * 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
+ */
+void
+GNUNET_FS_search_signal_suspend_ (void *cls);
+
+/**
+ * Create SUSPEND event for the given download operation
+ * and then clean up our state (without stop signal).
+ *
+ * @param cls the 'struct GNUNET_FS_DownloadContext' to signal for
+ */
+void
+GNUNET_FS_download_signal_suspend_ (void *cls);
+
+/**
+ * Create SUSPEND event for the given unindex operation
+ * and then clean up our state (without stop signal).
+ *
+ * @param cls the 'struct GNUNET_FS_UnindexContext' to signal for
+ */
+void
+GNUNET_FS_unindex_signal_suspend_ (void *cls);
/**
* Function signature of the functions that can be called
struct TopLevelActivity *top);
-/**
- * Create SUSPEND event for the given download operation
- * and then clean up our state (without stop signal).
- *
- * @param cls the 'struct GNUNET_FS_DownloadContext' to signal for
- */
-void
-GNUNET_FS_download_signal_suspend_ (void *cls);
-
/**
* Master context for most FS operations.
"Download tree has depth %u\n",
dc->treedepth);
#endif
+ if (parent == NULL)
+ dc->top = GNUNET_FS_make_top (dc->h,
+ &GNUNET_FS_download_signal_suspend_,
+ dc);
pi.status = GNUNET_FS_STATUS_DOWNLOAD_START;
pi.value.download.specifics.start.meta = meta;
GNUNET_FS_download_make_status_ (&pi, dc);
1 /* 0 == CHK, 1 == top */);
GNUNET_FS_download_sync_ (dc);
GNUNET_FS_download_start_downloading_ (dc);
- if (parent == NULL)
- dc->top = GNUNET_FS_make_top (dc->h,
- &GNUNET_FS_download_signal_suspend_,
- dc);
-
return dc;
}
GNUNET_FS_publish_main_ (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_FS_PublishContext *sc = cls;
+ struct GNUNET_FS_PublishContext *pc = cls;
struct GNUNET_FS_ProgressInfo pi;
struct GNUNET_FS_FileInformation *p;
char *fn;
- sc->upload_task = GNUNET_SCHEDULER_NO_TASK;
- p = sc->fi_pos;
+ pc->upload_task = GNUNET_SCHEDULER_NO_TASK;
+ p = pc->fi_pos;
if (NULL == p)
{
/* upload of entire hierarchy complete,
publish namespace entries */
- GNUNET_FS_publish_sync_ (sc);
- publish_sblock (sc);
+ GNUNET_FS_publish_sync_ (pc);
+ publish_sblock (pc);
return;
}
/* find starting position */
(NULL == p->data.dir.entries->chk_uri) )
{
p = p->data.dir.entries;
- sc->fi_pos = p;
- GNUNET_FS_publish_sync_ (sc);
+ pc->fi_pos = p;
+ GNUNET_FS_publish_sync_ (pc);
}
/* abort on error */
if (NULL != p->emsg)
pi.status = GNUNET_FS_STATUS_PUBLISH_ERROR;
pi.value.publish.eta = GNUNET_TIME_UNIT_FOREVER_REL;
pi.value.publish.specifics.error.message = p->emsg;
- p->client_info = GNUNET_FS_publish_make_status_ (&pi, sc, p, 0);
+ p->client_info = GNUNET_FS_publish_make_status_ (&pi, pc, p, 0);
}
- sc->all_done = GNUNET_YES;
- GNUNET_FS_publish_sync_ (sc);
+ pc->all_done = GNUNET_YES;
+ GNUNET_FS_publish_sync_ (pc);
return;
}
/* handle completion */
if (NULL != p->chk_uri)
{
- GNUNET_FS_publish_sync_ (sc);
+ GNUNET_FS_publish_sync_ (pc);
/* upload of "p" complete, publish KBlocks! */
if (p->keywords != NULL)
{
- GNUNET_FS_publish_ksk (sc->h,
+ GNUNET_FS_publish_ksk (pc->h,
p->keywords,
p->meta,
p->chk_uri,
p->expirationTime,
p->anonymity,
p->priority,
- sc->options,
+ pc->options,
&publish_kblocks_cont,
- sc);
+ pc);
}
else
{
- publish_kblocks_cont (sc,
+ publish_kblocks_cont (pc,
p->chk_uri,
NULL);
}
"<no-name>",
_("needs to be an actual file"));
GNUNET_FS_file_information_sync_ (p);
- publish_content (sc);
+ publish_content (pc);
return;
}
if (p->data.file.have_hash)
{
- hash_for_index_cb (sc,
+ hash_for_index_cb (pc,
&p->data.file.file_id);
}
else
{
p->start_time = GNUNET_TIME_absolute_get ();
- GNUNET_CRYPTO_hash_file (sc->h->sched,
+ GNUNET_CRYPTO_hash_file (pc->h->sched,
GNUNET_SCHEDULER_PRIORITY_IDLE,
p->filename,
HASHING_BLOCKSIZE,
&hash_for_index_cb,
- sc);
+ pc);
}
return;
}
- publish_content (sc);
+ publish_content (pc);
}
*
* @param cls the 'struct GNUNET_FS_PublishContext' to signal for
*/
-static void
-publish_signal_suspend (void *cls)
+void
+GNUNET_FS_publish_signal_suspend_ (void *cls)
{
struct GNUNET_FS_PublishContext *pc = cls;
&fip_signal_start,
ret);
ret->fi_pos = ret->fi;
- ret->top = GNUNET_FS_make_top (h, &publish_signal_suspend, ret);
+ ret->top = GNUNET_FS_make_top (h, &GNUNET_FS_publish_signal_suspend_, ret);
GNUNET_FS_publish_sync_ (ret);
// FIXME: calculate space needed for "fi"
// and reserve as first task (then trigger
}
-/**
- * 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
- */
-static void
-search_signal_suspend (void *cls);
-
-
/**
* Signal suspend and free the given search result.
*
if (sr->download != NULL)
GNUNET_FS_download_signal_suspend_ (sr->download);
if (sr->update_search != NULL)
- search_signal_suspend (sr->update_search);
+ GNUNET_FS_search_signal_suspend_ (sr->update_search);
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;
*
* @param cls the 'struct GNUNET_FS_SearchContext' to signal for
*/
-static void
-search_signal_suspend (void *cls)
+void
+GNUNET_FS_search_signal_suspend_ (void *cls)
{
struct GNUNET_FS_SearchContext *sc = cls;
struct GNUNET_FS_ProgressInfo pi;
{
struct GNUNET_FS_SearchContext *ret;
ret = search_start (h, uri, anonymity, options, cctx, NULL);
- ret->top = GNUNET_FS_make_top (h, &search_signal_suspend, ret);
+ ret->top = GNUNET_FS_make_top (h, &GNUNET_FS_search_signal_suspend_, ret);
return ret;
}
*
* @param cls the 'struct GNUNET_FS_UnindexContext' to signal for
*/
-static void
-unindex_signal_suspend (void *cls)
+void
+GNUNET_FS_unindex_signal_suspend_ (void *cls)
{
struct GNUNET_FS_UnindexContext *uc = cls;
struct GNUNET_FS_ProgressInfo pi;
&GNUNET_FS_unindex_process_hash_,
ret);
ret->top = GNUNET_FS_make_top (h,
- &unindex_signal_suspend,
+ &GNUNET_FS_unindex_signal_suspend_,
ret);
return ret;
}