allow empty/NULL context message
[oweals/gnunet.git] / src / transport / gnunet-transport.c
index 03bece6b737c96e305ecb69907de9641317c6ff3..cbddee9055345b033abe53978c3ca0ec66f4e416 100644 (file)
@@ -487,11 +487,9 @@ destroy_it (void *cls,
  * Stops monitoring activity.
  *
  * @param cls NULL
- * @param tc scheduler context
  */
 static void
-shutdown_task (void *cls,
-               const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
 {
   struct GNUNET_TIME_Relative duration;
   struct ValidationResolutionContext *cur;
@@ -598,8 +596,7 @@ shutdown_task (void *cls,
  * We are done, shut down.
  */
 static void
-operation_timeout (void *cls,
-                   const struct GNUNET_SCHEDULER_TaskContext *tc)
+operation_timeout (void *cls)
 {
   struct PeerResolutionContext *cur;
   struct PeerResolutionContext *next;
@@ -610,9 +607,7 @@ operation_timeout (void *cls,
     FPRINTF (stdout,
              _("Failed to connect to `%s'\n"),
              GNUNET_i2s_full (&pid));
-    if (NULL != end)
-      GNUNET_SCHEDULER_cancel (end);
-    end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
+    GNUNET_SCHEDULER_shutdown ();
     ret = 1;
     return;
   }
@@ -636,9 +631,7 @@ operation_timeout (void *cls,
     FPRINTF (stdout,
              "%s",
              _("Failed to list connections, timeout occured\n"));
-    if (NULL != end)
-      GNUNET_SCHEDULER_cancel (end);
-    end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
+    GNUNET_SCHEDULER_shutdown ();
     ret = 1;
     return;
   }
@@ -854,18 +847,13 @@ process_validation_string (void *cls,
   GNUNET_free (vc);
   if ((0 == address_resolutions) && (iterate_validation))
   {
-    if (NULL != end)
-    {
-      GNUNET_SCHEDULER_cancel (end);
-      end = NULL;
-    }
     if (NULL != op_timeout)
     {
       GNUNET_SCHEDULER_cancel (op_timeout);
       op_timeout = NULL;
     }
     ret = 0;
-    end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
+    GNUNET_SCHEDULER_shutdown ();
   }
 }
 
@@ -940,9 +928,7 @@ process_validation_cb (void *cls,
       return;
     }
     vic = NULL;
-    if (NULL != end)
-      GNUNET_SCHEDULER_cancel (end);
-    end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
+    GNUNET_SCHEDULER_shutdown ();
     return;
   }
   resolve_validation_address (address,
@@ -1367,19 +1353,13 @@ process_peer_string (void *cls,
   GNUNET_free (rc);
   if ((0 == address_resolutions) && (iterate_connections))
   {
-    if (NULL != end)
-    {
-      GNUNET_SCHEDULER_cancel (end);
-      end = NULL;
-    }
     if (NULL != op_timeout)
     {
       GNUNET_SCHEDULER_cancel (op_timeout);
       op_timeout = NULL;
     }
     ret = 0;
-    end = GNUNET_SCHEDULER_add_now (&shutdown_task,
-                                   NULL);
+    GNUNET_SCHEDULER_shutdown ();
   }
 }
 
@@ -1953,10 +1933,9 @@ testservice_task (void *cls,
     GNUNET_break(0);
     return;
   }
-
-  end = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
-                                      &shutdown_task,
-                                      NULL);
+  
+  GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+                                NULL);
 }