arg
[oweals/gnunet.git] / src / fs / test_fs_namespace_list_updateable.c
index 2637b1665c9c613086332a698b78cdecd7b917b4..291ab6d9dd619d93d0fb818e9e0a4e492a130690 100644 (file)
@@ -32,8 +32,6 @@
 
 #define START_ARM GNUNET_YES
 
-static struct GNUNET_SCHEDULER_Handle *sched;
-
 static struct PeerContext p1;
 
 static struct GNUNET_FS_Handle *fs;
@@ -42,14 +40,14 @@ static int err;
 
 static struct GNUNET_FS_Namespace *ns;
 
-static struct GNUNET_TIME_Absolute expiration;
-
 static struct GNUNET_CONTAINER_MetaData *meta;
 
 static struct GNUNET_FS_Uri *uri_this;
 
 static struct GNUNET_FS_Uri *uri_next;
 
+static struct GNUNET_FS_BlockOptions bo;
+
 
 struct PeerContext
 {
@@ -88,14 +86,17 @@ static void
 stop_arm (struct PeerContext *p)
 {
 #if START_ARM
-  if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
-  if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "ARM process %u stopped\n", GNUNET_OS_process_get_pid (p->arm_proc));
-  GNUNET_OS_process_close (p->arm_proc);
-  p->arm_proc = NULL;
+  if (NULL != p->arm_proc)
+    {
+      if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
+       GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
+      if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
+       GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "ARM process %u stopped\n", GNUNET_OS_process_get_pid (p->arm_proc));
+      GNUNET_OS_process_close (p->arm_proc);
+      p->arm_proc = NULL;
+    }
 #endif
   if (uri_this != NULL)
     GNUNET_FS_uri_destroy (uri_this);
@@ -174,6 +175,7 @@ sks_cont_this (void *cls,
               const struct GNUNET_FS_Uri *uri,
               const char *emsg)
 {
+
   GNUNET_assert (NULL == emsg);
   err = 1;
   GNUNET_FS_namespace_list_updateable (ns,
@@ -186,8 +188,7 @@ sks_cont_this (void *cls,
                         "future",
                         meta,
                         uri_next,
-                        expiration,
-                        1, 1,
+                        &bo,
                         GNUNET_FS_PUBLISH_OPTION_NONE,
                         &sks_cont_next,
                         NULL);
@@ -203,7 +204,10 @@ testNamespace ()
   ns = GNUNET_FS_namespace_create (fs,
                                   "testNamespace");
   GNUNET_assert (NULL != ns);
-  expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
+  bo.content_priority = 1;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
   meta = GNUNET_CONTAINER_meta_data_create ();
 
   uri_this =
@@ -216,8 +220,7 @@ testNamespace ()
                         "next",
                         meta,
                         uri_this,
-                        expiration,
-                        1, 1,
+                        &bo,
                         GNUNET_FS_PUBLISH_OPTION_NONE,
                         &sks_cont_this,
                         NULL);
@@ -226,15 +229,12 @@ testNamespace ()
 
 static void
 run (void *cls,
-     struct GNUNET_SCHEDULER_Handle *s,
      char *const *args,
      const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
-  sched = s;
   setup_peer (&p1, "test_fs_namespace_data.conf");
-  fs = GNUNET_FS_start (sched,
-                       cfg,
+  fs = GNUNET_FS_start (cfg,
                        "test-fs-namespace",
                        &progress_cb,
                        NULL,