fixing block reconstruction start/shutdown code
[oweals/gnunet.git] / src / fs / test_fs_unindex_persistence.c
index 42f047b70c0d948c80e35a32dd49e6896410b344..eec181544e0257b4e88e4018efe7f76ea263bc6f 100644 (file)
@@ -59,8 +59,6 @@ static struct PeerContext p1;
 
 static struct GNUNET_TIME_Absolute start;
 
-static struct GNUNET_SCHEDULER_Handle *sched;
-
 static struct GNUNET_FS_Handle *fs;
 
 static struct GNUNET_FS_UnindexContext *unindex;
@@ -108,8 +106,7 @@ restart_fs_task (void *cls,
                 const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   GNUNET_FS_stop (fs);
-  fs = GNUNET_FS_start (sched,
-                       cfg,
+  fs = GNUNET_FS_start (cfg,
                        "test-fs-unindex-persistence",
                        &progress_cb,
                        NULL,
@@ -135,8 +132,7 @@ consider_restart (int ev)
     if (prev[i] == ev)
       return;
   prev[off++] = ev;
-  GNUNET_SCHEDULER_add_with_priority (sched,
-                                     GNUNET_SCHEDULER_PRIORITY_URGENT,
+  GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_URGENT,
                                      &restart_fs_task,
                                      NULL);
 }
@@ -169,8 +165,7 @@ progress_cb (void *cls,
     case GNUNET_FS_STATUS_UNINDEX_COMPLETED:
       printf ("Unindex complete,  %llu kbps.\n",
              (unsigned long long) (FILESIZE * 1000 / (1+GNUNET_TIME_absolute_get_duration (start).rel_value) / 1024));
-      GNUNET_SCHEDULER_add_continuation (sched,
-                                        &abort_unindex_task,
+      GNUNET_SCHEDULER_add_continuation (&abort_unindex_task,
                                         NULL,
                                         GNUNET_SCHEDULER_REASON_PREREQ_DONE);
       break;
@@ -209,8 +204,7 @@ progress_cb (void *cls,
               "Error publishing file: %s\n",
               event->value.publish.specifics.error.message);
       GNUNET_break (0);
-      GNUNET_SCHEDULER_add_continuation (sched,
-                                        &abort_publish_task,
+      GNUNET_SCHEDULER_add_continuation (&abort_publish_task,
                                         NULL,
                                         GNUNET_SCHEDULER_REASON_PREREQ_DONE);
       break;
@@ -218,8 +212,7 @@ progress_cb (void *cls,
       fprintf (stderr,
               "Error unindexing file: %s\n",
               event->value.unindex.specifics.error.message);
-      GNUNET_SCHEDULER_add_continuation (sched,
-                                        &abort_unindex_task,
+      GNUNET_SCHEDULER_add_continuation (&abort_unindex_task,
                                         NULL,
                                         GNUNET_SCHEDULER_REASON_PREREQ_DONE);
       break;
@@ -247,8 +240,7 @@ progress_cb (void *cls,
       break;
     case GNUNET_FS_STATUS_UNINDEX_STOPPED:
       GNUNET_assert (unindex == event->value.unindex.uc);
-      GNUNET_SCHEDULER_add_continuation (sched,
-                                        &abort_publish_task,
+      GNUNET_SCHEDULER_add_continuation (&abort_publish_task,
                                         NULL,
                                         GNUNET_SCHEDULER_REASON_PREREQ_DONE);
       break;
@@ -296,7 +288,6 @@ stop_arm (struct PeerContext *p)
 
 static void
 run (void *cls,
-     struct GNUNET_SCHEDULER_Handle *s,
      char *const *args,
      const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
@@ -311,12 +302,10 @@ run (void *cls,
   struct GNUNET_FS_FileInformation *fi;
   size_t i;
 
-  sched = s;
   cfg = c;
   setup_peer (&p1, "test_fs_unindex_data.conf");
   fn = GNUNET_DISK_mktemp ("gnunet-unindex-test-dst");
-  fs = GNUNET_FS_start (sched,
-                       cfg,
+  fs = GNUNET_FS_start (cfg,
                        "test-fs-unindex-persistence",
                        &progress_cb,
                        NULL,