arg
[oweals/gnunet.git] / src / fs / test_fs_download.c
index 45df96043e76fd153c185539ce5ff4b99595392d..6bc287da345c4cf9df892c5d3842cb68ab242642 100644 (file)
@@ -150,7 +150,7 @@ progress_cb (void *cls,
 #endif      
       break;
     case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
-      printf ("Publishing complete, %llu kbps.\n",
+      printf ("Publishing complete, %llu kb/s.\n",
              (unsigned long long) (FILESIZE * 1000LL / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024LL));
       GAUGER ("FS",
              "Publishing speed (insertion)",
@@ -171,7 +171,7 @@ progress_cb (void *cls,
       GNUNET_assert (download != NULL);
       break;
     case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED:
-      printf ("Download complete,  %llu kbps.\n",
+      printf ("Download complete,  %llu kb/s.\n",
              (unsigned long long) (FILESIZE * 1000LL / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024LL));
       GAUGER ("FS",
              "Local download speed (inserted)",
@@ -267,14 +267,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
   GNUNET_CONFIGURATION_destroy (p->cfg);
 }
@@ -295,6 +298,7 @@ run (void *cls,
   struct GNUNET_FS_Uri *kuri;
   struct GNUNET_FS_FileInformation *fi;
   size_t i;
+  struct GNUNET_FS_BlockOptions bo;
 
   setup_peer (&p1, "test_fs_download_data.conf");
   fs = GNUNET_FS_start (cfg,
@@ -309,6 +313,10 @@ run (void *cls,
     buf[i] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 256);
   meta = GNUNET_CONTAINER_meta_data_create ();
   kuri = GNUNET_FS_uri_ksk_create_from_args (2, keywords);
+  bo.content_priority = 42;
+  bo.anonymity_level = 1;
+  bo.replication_level = 0;
+  bo.expiration_time = GNUNET_TIME_relative_to_absolute (LIFETIME); 
   fi = GNUNET_FS_file_information_create_from_data (fs,
                                                    "publish-context",
                                                    FILESIZE,
@@ -316,9 +324,7 @@ run (void *cls,
                                                    kuri,
                                                    meta,
                                                    GNUNET_NO,
-                                                   1,
-                                                   42,
-                                                   GNUNET_TIME_relative_to_absolute (LIFETIME)); 
+                                                   &bo);
   GNUNET_FS_uri_destroy (kuri);
   GNUNET_CONTAINER_meta_data_destroy (meta);
   GNUNET_assert (NULL != fi);