-fix, handle case where there is no update
[oweals/gnunet.git] / src / fs / test_gnunet_service_fs_p2p.c
index 889337ff41bc106c253aa47b4c2e7aa29937f3eb..e37a322b8cc56a16ae40e2335bf7a0be823b683a 100644 (file)
@@ -56,6 +56,7 @@ static struct GNUNET_TIME_Absolute start_time;
 static void
 do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
+  char *fn = cls;
   struct GNUNET_TIME_Relative del;
   char *fancy;
 
@@ -79,11 +80,17 @@ do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                 "Timeout during download, shutting down with error\n");
     ok = 1;
   }
+  if (NULL != fn)
+  {
+    GNUNET_DISK_directory_remove (fn);
+    GNUNET_free (fn);
+  }
 }
 
 
 static void
-do_download (void *cls, const struct GNUNET_FS_Uri *uri)
+do_download (void *cls, const struct GNUNET_FS_Uri *uri,
+            const char *fn)
 {
   if (NULL == uri)
   {
@@ -99,18 +106,22 @@ do_download (void *cls, const struct GNUNET_FS_Uri *uri)
   GNUNET_FS_TEST_download (daemons[0], TIMEOUT, 
                           anonymity_level, SEED, uri, 
                           VERBOSE, &do_stop,
-                           NULL);
+                           (NULL == fn) 
+                          ? NULL
+                          : GNUNET_strdup (fn));
 }
 
 
 static void
 do_publish (void *cls,
            unsigned int num_peers,
-           struct GNUNET_TESTBED_Peer **peers)
+           struct GNUNET_TESTBED_Peer **peers,
+            unsigned int links_succeeded,
+            unsigned int links_failed)
 {
   unsigned int i;
  
-  if (NULL != strstr (progname, "stream"))
+  if (NULL != strstr (progname, "mesh"))
     anonymity_level = 0;
   else
     anonymity_level = 1;
@@ -132,8 +143,8 @@ main (int argc, char *argv[])
   const char *config;
 
   progname = argv[0];
-  if (NULL != strstr (progname, "stream"))
-    config = "test_gnunet_service_fs_p2p_stream.conf";
+  if (NULL != strstr (progname, "mesh"))
+    config = "test_gnunet_service_fs_p2p_mesh.conf";
   else
     config = "fs_test_lib_data.conf";
   (void) GNUNET_TESTBED_test_run ("test-gnunet-service-fs-p2p",