[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11205 - gnunet/src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11205 - gnunet/src/fs |
Date: |
Thu, 6 May 2010 08:57:16 +0200 |
Author: grothoff
Date: 2010-05-06 08:57:16 +0200 (Thu, 06 May 2010)
New Revision: 11205
Modified:
gnunet/src/fs/fs.c
gnunet/src/fs/fs.h
gnunet/src/fs/fs_download.c
gnunet/src/fs/fs_publish.c
gnunet/src/fs/fs_search.c
gnunet/src/fs/fs_unindex.c
Log:
init top on deserialization
Modified: gnunet/src/fs/fs.c
===================================================================
--- gnunet/src/fs/fs.c 2010-05-05 15:50:38 UTC (rev 11204)
+++ gnunet/src/fs/fs.c 2010-05-06 06:57:16 UTC (rev 11205)
@@ -749,6 +749,7 @@
return NULL;
}
ret = GNUNET_malloc (sizeof (struct GNUNET_FS_FileInformation));
+ ret->h = h;
ksks = NULL;
chks = NULL;
filename = NULL;
@@ -1382,6 +1383,7 @@
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);
@@ -1914,6 +1916,9 @@
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,
@@ -2468,7 +2473,12 @@
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:
@@ -2604,6 +2614,7 @@
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);
@@ -2616,7 +2627,8 @@
}
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))
Modified: gnunet/src/fs/fs.h
===================================================================
--- gnunet/src/fs/fs.h 2010-05-05 15:50:38 UTC (rev 11204)
+++ gnunet/src/fs/fs.h 2010-05-06 06:57:16 UTC (rev 11205)
@@ -1018,8 +1018,43 @@
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
* to trigger suspend signals and clean-up for top-level
* activities.
@@ -1081,16 +1116,7 @@
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.
*/
Modified: gnunet/src/fs/fs_download.c
===================================================================
--- gnunet/src/fs/fs_download.c 2010-05-05 15:50:38 UTC (rev 11204)
+++ gnunet/src/fs/fs_download.c 2010-05-06 06:57:16 UTC (rev 11205)
@@ -1558,6 +1558,10 @@
"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);
@@ -1567,11 +1571,6 @@
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;
}
Modified: gnunet/src/fs/fs_publish.c
===================================================================
--- gnunet/src/fs/fs_publish.c 2010-05-05 15:50:38 UTC (rev 11204)
+++ gnunet/src/fs/fs_publish.c 2010-05-06 06:57:16 UTC (rev 11205)
@@ -797,19 +797,19 @@
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 */
@@ -819,8 +819,8 @@
(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)
@@ -849,33 +849,33 @@
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);
}
@@ -892,27 +892,27 @@
"<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);
}
@@ -998,8 +998,8 @@
*
* @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;
@@ -1068,7 +1068,7 @@
&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
Modified: gnunet/src/fs/fs_search.c
===================================================================
--- gnunet/src/fs/fs_search.c 2010-05-05 15:50:38 UTC (rev 11204)
+++ gnunet/src/fs/fs_search.c 2010-05-06 06:57:16 UTC (rev 11205)
@@ -1233,16 +1233,6 @@
/**
- * 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.
*
* @param cls the global FS handle
@@ -1263,7 +1253,7 @@
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;
@@ -1289,8 +1279,8 @@
*
* @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;
@@ -1342,7 +1332,7 @@
{
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;
}
Modified: gnunet/src/fs/fs_unindex.c
===================================================================
--- gnunet/src/fs/fs_unindex.c 2010-05-05 15:50:38 UTC (rev 11204)
+++ gnunet/src/fs/fs_unindex.c 2010-05-06 06:57:16 UTC (rev 11205)
@@ -404,8 +404,8 @@
*
* @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;
@@ -462,7 +462,7 @@
&GNUNET_FS_unindex_process_hash_,
ret);
ret->top = GNUNET_FS_make_top (h,
- &unindex_signal_suspend,
+ &GNUNET_FS_unindex_signal_suspend_,
ret);
return ret;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11205 - gnunet/src/fs,
gnunet <=