generate progress events when publishing directories (towards fixing #2230)
[oweals/gnunet.git] / src / fs / test_fs_search_probes.c
index b2f1e0bf11ba66e42df1526b79170dd926248f45..beae34763c0d0f2deadea9e6312f168118189780 100644 (file)
@@ -61,18 +61,19 @@ static int err;
 static void
 abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
+  timeout_task = GNUNET_SCHEDULER_NO_TASK;
   fprintf (stderr,
           "Timeout\n");
-  if (NULL != publish)
-  {
-    GNUNET_FS_publish_stop (publish);
-    publish = NULL;
-  }
   if (NULL != search)
   {
     GNUNET_FS_search_stop (search);
     search = NULL;
   }
+  if (NULL != publish)
+  {
+    GNUNET_FS_publish_stop (publish);
+    publish = NULL;
+  }
   err = 1;
 }
 
@@ -80,8 +81,16 @@ abort_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 static void
 abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  GNUNET_FS_publish_stop (publish);
-  publish = NULL;
+  if (NULL != publish)
+  {
+    GNUNET_FS_publish_stop (publish);
+    publish = NULL;
+  }
+  if (GNUNET_SCHEDULER_NO_TASK != timeout_task)
+  {
+    GNUNET_SCHEDULER_cancel (timeout_task);
+    timeout_task = GNUNET_SCHEDULER_NO_TASK;
+  }
 }
 
 
@@ -113,6 +122,8 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
                (unsigned long long) event->value.publish.specifics.
                progress.offset);
     break;
+  case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
+    break;
   case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
     kuri = GNUNET_FS_uri_ksk_create_from_args (1, keywords);
     start = GNUNET_TIME_absolute_get ();
@@ -194,7 +205,7 @@ run (void *cls,
   size_t i;
 
   fs = GNUNET_FS_start (cfg, "test-fs-search", &progress_cb, NULL,
-                        GNUNET_FS_FLAGS_DO_PROBES, 
+                        GNUNET_FS_FLAGS_DO_PROBES,
                        GNUNET_FS_OPTIONS_END);
   GNUNET_assert (NULL != fs);
   buf = GNUNET_malloc (FILESIZE);