fix
[oweals/gnunet.git] / src / fs / test_gnunet_service_fs_migration.c
index b0aa3eebfde84a48a4d70f8ccf1cec806f3f152b..ae502158e88dc7389eac18d3497340ce92cbc434 100644 (file)
@@ -4,7 +4,7 @@
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
 /**
  * How long until we give up on transmitting the message?
  */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
 
 /**
  * How long do we give the peers for content migration?
  */
-#define MIGRATION_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
+#define MIGRATION_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
 
 #define SEED 42
 
@@ -101,6 +101,7 @@ do_download (void *cls,
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                  "Failed to stop source daemon: %s\n",
                  emsg);
+      GNUNET_FS_uri_destroy (uri);
       ok = 1;
       return;
     }
@@ -114,6 +115,7 @@ do_download (void *cls,
                           1, SEED, uri, 
                           VERBOSE, 
                           &do_stop, NULL);
+  GNUNET_FS_uri_destroy (uri);
 }
 
 
@@ -152,10 +154,10 @@ do_wait (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Waiting to allow content to migrate\n"); 
   d = GNUNET_FS_uri_dup (uri);
-  GNUNET_SCHEDULER_add_delayed (sched,
-                               MIGRATION_DELAY,
-                               &stop_source_peer,
-                               d);
+  (void) GNUNET_SCHEDULER_add_delayed (sched,
+                                      MIGRATION_DELAY,
+                                      &stop_source_peer,
+                                      d);
 }
 
 
@@ -189,7 +191,14 @@ static void
 do_connect (void *cls,
            const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE));
+  if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE))
+    {
+      fprintf (stderr,
+              "Daemons failed to start!\n");
+      GNUNET_break (0);
+      ok = 1;
+      return;
+    }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Daemons started, will now try to connect them\n");
   GNUNET_FS_TEST_daemons_connect (sched,