gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6796 - GNUnet/src/applications/fs/fsui


From: gnunet
Subject: [GNUnet-SVN] r6796 - GNUnet/src/applications/fs/fsui
Date: Sat, 10 May 2008 23:16:50 -0600 (MDT)

Author: grothoff
Date: 2008-05-10 23:16:49 -0600 (Sat, 10 May 2008)
New Revision: 6796

Modified:
   GNUnet/src/applications/fs/fsui/download.c
   GNUnet/src/applications/fs/fsui/fsui.h
   GNUnet/src/applications/fs/fsui/serializetest2.c
Log:
fixing deadlock

Modified: GNUnet/src/applications/fs/fsui/download.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download.c  2008-05-10 23:41:29 UTC (rev 
6795)
+++ GNUnet/src/applications/fs/fsui/download.c  2008-05-11 05:16:49 UTC (rev 
6796)
@@ -219,7 +219,6 @@
 {
   GNUNET_FSUI_DownloadList *dl = cls;
   GNUNET_FSUI_Event event;
-  struct GNUNET_ECRS_MetaData *md;
   GNUNET_CronTime now;
   GNUNET_CronTime run_time;
 
@@ -288,31 +287,6 @@
       else
         dl->is_directory = GNUNET_NO;
     }
-  if (dl->is_directory == GNUNET_YES)
-    {
-      md = NULL;
-      GNUNET_ECRS_directory_list_contents (dl->ctx->ectx,
-                                           lastBlock,
-                                           lastBlockSize, &md,
-                                           &listURIfoundDirectory, dl);
-      if (md != NULL)
-        GNUNET_ECRS_meta_data_destroy (md);
-    }
-  if ((dl->is_recursive == GNUNET_YES) && (dl->is_directory == GNUNET_YES))
-    {
-      int n;
-      md = NULL;
-      GNUNET_mutex_lock (dl->ctx->lock);
-      n = GNUNET_ECRS_directory_list_contents (dl->ctx->ectx,
-                                               lastBlock,
-                                               lastBlockSize, &md,
-                                               &triggerRecursiveDownload, dl);
-      GNUNET_mutex_unlock (dl->ctx->lock);
-      if (n == 0)
-        GNUNET_disk_directory_create (dl->ctx->ectx, dl->filename);
-      if (md != NULL)
-        GNUNET_ECRS_meta_data_destroy (md);
-    }
   if (totalBytes == completedBytes)
     {
       dl->state = GNUNET_FSUI_COMPLETED;
@@ -333,9 +307,6 @@
                                  dl->fi.uri,
                                  GNUNET_URITRACK_DOWNLOAD_COMPLETED);
       dl->ctx->ecb (dl->ctx->ecbClosure, &event);
-      if ((dl->is_directory == GNUNET_YES) &&
-          (GNUNET_ECRS_uri_get_file_size (dl->fi.uri) > 0))
-        download_recursive (dl);
     }
 }
 
@@ -534,7 +505,20 @@
       list->state++;            /* adds _JOINED */
       ret = GNUNET_YES;
     }
-
+  /* Trigger any recursive sub-downloads */
+  if ( (list->state == GNUNET_FSUI_COMPLETED) &&
+       (list->is_directory == GNUNET_YES) )
+    {
+      /* in case there is no sub-download, still
+        create the (possibly empty) directory! */
+      GNUNET_disk_directory_create (list->ctx->ectx, list->filename);
+      if ( (list->is_recursive == GNUNET_YES) &&
+          (GNUNET_ECRS_uri_get_file_size (list->fi.uri) > 0) )
+       {
+         download_recursive (list);
+         list->is_recursive = GNUNET_NO;
+       }
+    }
   dpos = list->child;
   while (dpos != NULL)
     {

Modified: GNUnet/src/applications/fs/fsui/fsui.h
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.h      2008-05-10 23:41:29 UTC (rev 
6795)
+++ GNUnet/src/applications/fs/fsui/fsui.h      2008-05-11 05:16:49 UTC (rev 
6796)
@@ -312,6 +312,8 @@
 
   /**
    * Is this a recursive download? (GNUNET_YES/GNUNET_NO)
+   * Also set to GNUNET_NO once the recursive downloads
+   * have been triggered!
    */
   int is_recursive;
 

Modified: GNUnet/src/applications/fs/fsui/serializetest2.c
===================================================================
--- GNUnet/src/applications/fs/fsui/serializetest2.c    2008-05-10 23:41:29 UTC 
(rev 6795)
+++ GNUnet/src/applications/fs/fsui/serializetest2.c    2008-05-11 05:16:49 UTC 
(rev 6796)
@@ -111,6 +111,7 @@
         {
           fprintf (stderr,
                    "Download resuming but search reference not set 
correctly.\n");
+         abort();
           have_error = 1;
         }
       if ((event->data.DownloadResumed.dc.pos == download) &&





reply via email to

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