WiP
[oweals/gnunet.git] / src / dht / gnunet-dht-get-peer.c
index f6974cddb4cbb96f371eea5cca2ba805649a9e7a..8d318efc2ed17528403f3fade73241771e2c450f 100644 (file)
@@ -52,10 +52,6 @@ static int verbose;
  */
 static struct GNUNET_DHT_Handle *dht_handle;
 
-/**
- * Global handle of the scheduler
- */
-static struct GNUNET_SCHEDULER_Handle *sched;
 
 /**
  * Global handle of the configuration
@@ -101,7 +97,7 @@ cleanup_task (void *cls,
       GNUNET_DHT_find_peer_stop (find_peer_handle);
       find_peer_handle = NULL;
     }
-  GNUNET_SCHEDULER_add_now (sched, &shutdown_task, NULL);
+  GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
 }
 
 /**
@@ -132,20 +128,17 @@ find_peer_processor (void *cls,
  * Main function that will be run by the scheduler.
  *
  * @param cls closure
- * @param s the scheduler to use
  * @param args remaining command-line arguments
  * @param cfgfile name of the configuration file used (for saving, can be NULL!)
  * @param c configuration
  */
 static void
 run (void *cls,
-     struct GNUNET_SCHEDULER_Handle *s,
      char *const *args,
      const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
 {
   struct GNUNET_TIME_Relative timeout;
   GNUNET_HashCode key;
-  sched = s;
   cfg = c;
 
   if (query_key == NULL)
@@ -156,7 +149,7 @@ run (void *cls,
       return;
     }
 
-  dht_handle = GNUNET_DHT_connect (sched, cfg, 1);
+  dht_handle = GNUNET_DHT_connect (cfg, 1);
 
   if (dht_handle == NULL)
     {
@@ -185,11 +178,10 @@ run (void *cls,
                                                  NULL);
   if (NULL == find_peer_handle)
     {
-      GNUNET_SCHEDULER_add_now (sched, &shutdown_task, NULL);
+      GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
       return;
     }
-  GNUNET_SCHEDULER_add_delayed (sched,
-                               GNUNET_TIME_absolute_get_remaining
+  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining
                                (absolute_timeout),
                                &cleanup_task, NULL);
 }