Avoid trying to disconnect a neighbour twice
[oweals/gnunet.git] / src / transport / gnunet-service-transport_hello.c
index 7b5f79a4aa63d0f8bd543543ff60141d4d14cab4..00df3d00cbbbb16aa48b0e9795636d1b5704ecfb 100644 (file)
@@ -112,7 +112,7 @@ static int friend_option;
 /**
  * Identifier of #refresh_hello_task().
  */
-static struct GNUNET_SCHEDULER_Task * hello_task;
+static struct GNUNET_SCHEDULER_Task *hello_task;
 
 
 /**
@@ -180,7 +180,6 @@ refresh_hello_task (void *cls,
                                   &address_generator,
                                   &gc,
                                    friend_option);
-  GNUNET_assert (NULL != our_hello);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Refreshed my %s HELLO, new size is %d\n",
               (GNUNET_YES == friend_option) ? "friend-only" : "public",
@@ -204,16 +203,19 @@ refresh_hello_task (void *cls,
 
 
 /**
- * Schedule task to refresh hello (unless such a
- * task exists already).
+ * Schedule task to refresh hello (but only if such a
+ * task exists already, as otherwise the module might
+ * have been shutdown).
  */
 static void
 refresh_hello ()
 {
   if (NULL != hello_task)
+  {
     GNUNET_SCHEDULER_cancel (hello_task);
-  hello_task = GNUNET_SCHEDULER_add_now (&refresh_hello_task,
-                                         NULL);
+    hello_task = GNUNET_SCHEDULER_add_now (&refresh_hello_task,
+                                           NULL);
+  }
 }
 
 
@@ -232,7 +234,7 @@ GST_hello_start (int friend_only,
   hello_cb = cb;
   hello_cb_cls = cb_cls;
   friend_option = friend_only;
-  refresh_hello ();
+  refresh_hello_task (NULL, NULL);
 }