Fix for #4553
[oweals/gnunet.git] / src / topology / gnunet-daemon-topology.c
index 7a124c1070d48bd6ed77f00e6b40d63ce537977d..eddac8c8ad01e35fcb443cb038f2550632160ef2 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2007-2015 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2007-2015 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -506,11 +506,9 @@ find_advertisable_hello (void *cls,
  * peer and ask for it.
  *
  * @param cls for which peer to schedule the HELLO
- * @param tc task context
  */
 static void
-schedule_next_hello (void *cls,
-                     const struct GNUNET_SCHEDULER_TaskContext *tc)
+schedule_next_hello (void *cls)
 {
   struct Peer *pl = cls;
   struct FindAdvHelloContext fah;
@@ -519,8 +517,6 @@ schedule_next_hello (void *cls,
 
   pl->hello_delay_task = NULL;
   GNUNET_assert (GNUNET_YES == pl->is_connected);
-  if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
-    return;                     /* we're out of here */
   if (pl->hello_req != NULL)
     return;                     /* did not finish sending the previous one */
   /* find applicable HELLOs */
@@ -535,7 +531,7 @@ schedule_next_hello (void *cls,
       GNUNET_SCHEDULER_add_delayed (fah.next_adv,
                                     &schedule_next_hello,
                                     pl);
-  if (fah.result == NULL)
+  if (NULL == fah.result)
     return;
   next_want = GNUNET_HELLO_size (fah.result->hello);
   delay = GNUNET_TIME_absolute_get_remaining (pl->next_hello_allowed);
@@ -669,11 +665,9 @@ try_add_peers (void *cls,
  * Add peers and schedule connection attempt
  *
  * @param cls unused, NULL
- * @param tc scheduler context
  */
 static void
-add_peer_task (void *cls,
-               const struct GNUNET_SCHEDULER_TaskContext *tc)
+add_peer_task (void *cls)
 {
   add_task = NULL;
 
@@ -1133,11 +1127,9 @@ hello_advertising_ready (void *cls,
  * the transport and core.
  *
  * @param cls unused, NULL
- * @param tc scheduler context
  */
 static void
-cleaning_task (void *cls,
-               const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleaning_task (void *cls)
 {
   if (NULL != peerinfo_notify)
   {
@@ -1245,9 +1237,8 @@ run (void *cls,
                            NULL, GNUNET_NO,
                            NULL, GNUNET_NO,
                            handlers);
-  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
-                                &cleaning_task,
-                                NULL);
+  GNUNET_SCHEDULER_add_shutdown (&cleaning_task,
+                                NULL);
   if (NULL == transport)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,