- implementation for mantis 0002485
[oweals/gnunet.git] / src / topology / gnunet-daemon-topology.c
index 15ca9f87b48e7631e86d5d62b03d47f130a05ef9..3578b9e9be3e9b1c03841a8c9a664114c0044245 100644 (file)
@@ -316,7 +316,7 @@ is_connection_allowed (struct Peer *peer)
  * @return GNUNET_YES (always: continue to iterate)
  */
 static int
-free_peer (void *cls, const GNUNET_HashCode * pid, void *value)
+free_peer (void *cls, const struct GNUNET_HashCode * pid, void *value)
 {
   struct Peer *pos = value;
 
@@ -328,7 +328,7 @@ free_peer (void *cls, const GNUNET_HashCode * pid, void *value)
   if (pos->hello_delay_task != GNUNET_SCHEDULER_NO_TASK)
     GNUNET_SCHEDULER_cancel (pos->hello_delay_task);
   if (pos->attempt_connect_task != GNUNET_SCHEDULER_NO_TASK)
-    GNUNET_SCHEDULER_cancel (pos->hello_delay_task);
+    GNUNET_SCHEDULER_cancel (pos->attempt_connect_task);
   if (pos->greylist_clean_task != GNUNET_SCHEDULER_NO_TASK)
     GNUNET_SCHEDULER_cancel (pos->greylist_clean_task);
   GNUNET_free_non_null (pos->hello);
@@ -398,7 +398,8 @@ attempt_connect (struct Peer *pos)
 /**
  * Try to connect to the specified peer.
  *
- * @param pos peer to connect to
+ * @param cls peer to connect to
+ * @param tc scheduler context
  */
 static void
 do_attempt_connect (void *cls,
@@ -572,7 +573,7 @@ struct FindAdvHelloContext
  * @return GNUNET_YES (continue iteration)
  */
 static int
-find_advertisable_hello (void *cls, const GNUNET_HashCode * pid, void *value)
+find_advertisable_hello (void *cls, const struct GNUNET_HashCode * pid, void *value)
 {
   struct FindAdvHelloContext *fah = cls;
   struct Peer *pos = value;
@@ -658,7 +659,7 @@ schedule_next_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  * @return GNUNET_YES (always)
  */
 static int
-reschedule_hellos (void *cls, const GNUNET_HashCode * pid, void *value)
+reschedule_hellos (void *cls, const struct GNUNET_HashCode * pid, void *value)
 {
   struct Peer *peer = value;
   struct Peer *skip = cls;
@@ -742,7 +743,7 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer,
  * @return GNUNET_YES (continue to iterate)
  */
 static int
-try_add_peers (void *cls, const GNUNET_HashCode * pid, void *value)
+try_add_peers (void *cls, const struct GNUNET_HashCode * pid, void *value)
 {
   struct Peer *pos = value;
 
@@ -1318,7 +1319,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     blacklist = GNUNET_TRANSPORT_blacklist (cfg, &blacklist_check, NULL);
   transport = GNUNET_TRANSPORT_connect (cfg, NULL, NULL, NULL, NULL, NULL);
   handle =
-      GNUNET_CORE_connect (cfg, 1, NULL, &core_init, &connect_notify,
+      GNUNET_CORE_connect (cfg, NULL, &core_init, &connect_notify,
                            &disconnect_notify, NULL, GNUNET_NO, NULL, GNUNET_NO,
                            handlers);
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleaning_task,
@@ -1355,6 +1356,9 @@ main (int argc, char *const *argv)
   };
   int ret;
 
+  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
+    return 2;
+
   ret =
       (GNUNET_OK ==
        GNUNET_PROGRAM_run (argc, argv, "gnunet-daemon-topology",