gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r21806 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r21806 - gnunet/src/fs
Date: Fri, 8 Jun 2012 16:57:26 +0200

Author: grothoff
Date: 2012-06-08 16:57:26 +0200 (Fri, 08 Jun 2012)
New Revision: 21806

Modified:
   gnunet/src/fs/fs_file_information.c
   gnunet/src/fs/fs_publish.c
Log:
-fixing #2412

Modified: gnunet/src/fs/fs_file_information.c
===================================================================
--- gnunet/src/fs/fs_file_information.c 2012-06-08 14:14:21 UTC (rev 21805)
+++ gnunet/src/fs/fs_file_information.c 2012-06-08 14:57:26 UTC (rev 21806)
@@ -367,7 +367,8 @@
   if (GNUNET_OK !=
       proc (proc_cls, dir,
             (dir->is_directory == GNUNET_YES) ? dir->data.dir.dir_size : 
dir->data.
-            file.file_size, dir->meta, &dir->keywords, &dir->bo,
+            file.file_size,
+           dir->meta, &dir->keywords, &dir->bo,
             (dir->is_directory == GNUNET_YES) ? &no : &dir->data.file.do_index,
             &dir->client_info))
     return;

Modified: gnunet/src/fs/fs_publish.c
===================================================================
--- gnunet/src/fs/fs_publish.c  2012-06-08 14:14:21 UTC (rev 21805)
+++ gnunet/src/fs/fs_publish.c  2012-06-08 14:57:26 UTC (rev 21806)
@@ -959,41 +959,19 @@
 
 
 /**
- * Signal the FS's progress function that we are suspending
+ * Actually signal the FS's progress function that we are suspending
  * an upload.
  *
  * @param cls closure (of type "struct GNUNET_FS_PublishContext*")
  * @param fi the entry in the publish-structure
- * @param length length of the file or directory
- * @param meta metadata for the file or directory (can be modified)
- * @param uri pointer to the keywords that will be used for this entry (can be 
modified)
- * @param bo block options
- * @param do_index should we index?
- * @param client_info pointer to client context set upon creation (can be 
modified)
- * @return GNUNET_OK to continue (always)
  */
-static int
-fip_signal_suspend (void *cls, struct GNUNET_FS_FileInformation *fi,
-                    uint64_t length, struct GNUNET_CONTAINER_MetaData *meta,
-                    struct GNUNET_FS_Uri **uri,
-                    struct GNUNET_FS_BlockOptions *bo, int *do_index,
-                    void **client_info)
+static void
+suspend_operation (struct GNUNET_FS_FileInformation *fi,
+                  struct GNUNET_FS_PublishContext *pc)
 {
-  struct GNUNET_FS_PublishContext *pc = cls;
   struct GNUNET_FS_ProgressInfo pi;
   uint64_t off;
 
-  if (GNUNET_YES == pc->skip_next_fi_callback)
-  {
-    pc->skip_next_fi_callback = GNUNET_NO;
-    return GNUNET_OK;
-  }
-  if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (meta))
-  {
-    /* process entries in directory */
-    pc->skip_next_fi_callback = GNUNET_YES;
-    GNUNET_FS_file_information_inspect (fi, &fip_signal_suspend, pc);
-  }
   if (NULL != pc->ksk_pc)
   {
     GNUNET_FS_publish_ksk_cancel (pc->ksk_pc);
@@ -1007,10 +985,9 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Suspending publish operation\n");
   GNUNET_free_non_null (fi->serialization);
   fi->serialization = NULL;
-  off = (fi->chk_uri == NULL) ? 0 : length;
+  off = (fi->chk_uri == NULL) ? 0 : (fi->is_directory == GNUNET_YES) ? 
fi->data.dir.dir_size : fi->data.file.file_size;
   pi.status = GNUNET_FS_STATUS_PUBLISH_SUSPEND;
   GNUNET_break (NULL == GNUNET_FS_publish_make_status_ (&pi, pc, fi, off));
-  *client_info = NULL;
   if (NULL != pc->qre)
   {
     GNUNET_DATASTORE_cancel (pc->qre);
@@ -1022,6 +999,45 @@
     pc->dsh = NULL;
   }
   pc->rid = 0;
+}
+
+
+/**
+ * Signal the FS's progress function that we are suspending
+ * an upload.  Performs the recursion.
+ *
+ * @param cls closure (of type "struct GNUNET_FS_PublishContext*")
+ * @param fi the entry in the publish-structure
+ * @param length length of the file or directory
+ * @param meta metadata for the file or directory (can be modified)
+ * @param uri pointer to the keywords that will be used for this entry (can be 
modified)
+ * @param bo block options
+ * @param do_index should we index?
+ * @param client_info pointer to client context set upon creation (can be 
modified)
+ * @return GNUNET_OK to continue (always)
+ */
+static int
+fip_signal_suspend (void *cls, struct GNUNET_FS_FileInformation *fi,
+                    uint64_t length, struct GNUNET_CONTAINER_MetaData *meta,
+                    struct GNUNET_FS_Uri **uri,
+                    struct GNUNET_FS_BlockOptions *bo, int *do_index,
+                    void **client_info)
+{
+  struct GNUNET_FS_PublishContext *pc = cls;
+
+  if (GNUNET_YES == pc->skip_next_fi_callback)
+  {
+    pc->skip_next_fi_callback = GNUNET_NO;
+    return GNUNET_OK;
+  }
+  if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (meta))
+  {
+    /* process entries in directory */
+    pc->skip_next_fi_callback = GNUNET_YES;
+    GNUNET_FS_file_information_inspect (fi, &fip_signal_suspend, pc);
+  }
+  suspend_operation (fi, pc);
+  *client_info = NULL;
   return GNUNET_OK;
 }
 
@@ -1042,7 +1058,9 @@
     GNUNET_SCHEDULER_cancel (pc->upload_task);
     pc->upload_task = GNUNET_SCHEDULER_NO_TASK;
   }
+  pc->skip_next_fi_callback = GNUNET_YES;
   GNUNET_FS_file_information_inspect (pc->fi, &fip_signal_suspend, pc);
+  suspend_operation (pc->fi, pc);
   GNUNET_FS_end_top (pc->h, pc->top);
   pc->top = NULL;
   publish_cleanup (pc);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]