fix
[oweals/gnunet.git] / src / fs / test_fs_unindex.c
index eb10c1db96a16a759e1e801990c0f7410cab1dd1..21bdc3cb3d1d1f44465246919b4a5120bbc701cf 100644 (file)
@@ -41,7 +41,7 @@
 /**
  * How long until we give up on transmitting the message?
  */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
 
 /**
  * How long should our test-content live?
@@ -121,7 +121,6 @@ progress_cb (void *cls,
       printf ("Unindex complete,  %llu kbps.\n",
              (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).value) / 1024));
       GNUNET_SCHEDULER_add_continuation (sched,
-                                        GNUNET_NO,
                                         &abort_unindex_task,
                                         NULL,
                                         GNUNET_SCHEDULER_REASON_PREREQ_DONE);
@@ -142,7 +141,6 @@ progress_cb (void *cls,
               event->value.publish.specifics.error.message);
       GNUNET_break (0);
       GNUNET_SCHEDULER_add_continuation (sched,
-                                        GNUNET_NO,
                                         &abort_publish_task,
                                         NULL,
                                         GNUNET_SCHEDULER_REASON_PREREQ_DONE);
@@ -152,7 +150,6 @@ progress_cb (void *cls,
               "Error unindexing file: %s\n",
               event->value.unindex.specifics.error.message);
       GNUNET_SCHEDULER_add_continuation (sched,
-                                        GNUNET_NO,
                                         &abort_unindex_task,
                                         NULL,
                                         GNUNET_SCHEDULER_REASON_PREREQ_DONE);
@@ -165,7 +162,7 @@ progress_cb (void *cls,
       GNUNET_assert (1 == event->value.publish.anonymity);
       break;
     case GNUNET_FS_STATUS_PUBLISH_STOPPED:
-      GNUNET_assert (publish == event->value.publish.sc);
+      GNUNET_assert (publish == event->value.publish.pc);
       GNUNET_assert (FILESIZE == event->value.publish.size);
       GNUNET_assert (1 == event->value.publish.anonymity);
       GNUNET_FS_stop (fs);
@@ -181,7 +178,6 @@ progress_cb (void *cls,
     case GNUNET_FS_STATUS_UNINDEX_STOPPED:
       GNUNET_assert (unindex == event->value.unindex.uc);
       GNUNET_SCHEDULER_add_continuation (sched,
-                                        GNUNET_NO,
                                         &abort_publish_task,
                                         NULL,
                                         GNUNET_SCHEDULER_REASON_PREREQ_DONE);
@@ -200,16 +196,14 @@ setup_peer (struct PeerContext *p, const char *cfgname)
 {
   p->cfg = GNUNET_CONFIGURATION_create ();
 #if START_ARM
-  p->arm_pid = GNUNET_OS_start_process ("gnunet-service-arm",
+  p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
                                         "gnunet-service-arm",
 #if VERBOSE
                                         "-L", "DEBUG",
 #endif
                                         "-c", cfgname, NULL);
-  sleep (1);                    /* allow ARM to start */
 #endif
   GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
-  GNUNET_ARM_start_services (p->cfg, sched, "core", NULL);
 }
 
 
@@ -267,7 +261,8 @@ run (void *cls,
   GNUNET_free (buf);
   meta = GNUNET_CONTAINER_meta_data_create ();
   kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
-  fi = GNUNET_FS_file_information_create_from_file ("publish-context",
+  fi = GNUNET_FS_file_information_create_from_file (fs,
+                                                   "publish-context",
                                                    fn,
                                                    kuri,
                                                    meta,
@@ -315,8 +310,11 @@ main (int argc, char *argv[])
                      "nohelp", options, &run, NULL);
   stop_arm (&p1);
   GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-unindex/");
-  GNUNET_DISK_directory_remove (fn);
-  GNUNET_free_non_null (fn);
+  if (NULL != fn)
+    {
+      GNUNET_DISK_directory_remove (fn);
+      GNUNET_free (fn);
+    }
   return 0;
 }