fixing confs: core tests should pass
[oweals/gnunet.git] / src / core / gnunet-core.c
index ebdd8aab3624466ca1fb48456f0eb6e16ffef81e..17b840480dbbc713fc7043d6f75d226389af5b3d 100644 (file)
@@ -110,7 +110,8 @@ monitor_notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
                 const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
 {
   struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get();
-  char *now_str;
+  const char *now_str;
+
   if (0 != memcmp (&my_id, peer, sizeof (my_id)))
   {
     monitor_connections_counter ++;
@@ -120,8 +121,6 @@ monitor_notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
              _("Connected to"),
              GNUNET_i2s (peer),
              monitor_connections_counter);
-
-    GNUNET_free (now_str);
   }
 }
 
@@ -137,21 +136,19 @@ static void
 monitor_notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
 {
   struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get();
-  char *now_str;
+  const char *now_str;
 
   if (0 != memcmp (&my_id, peer, sizeof (my_id)))
   {
     now_str = GNUNET_STRINGS_absolute_time_to_string (now);
 
     GNUNET_assert (monitor_connections_counter > 0);
-    monitor_connections_counter --;
-
+    monitor_connections_counter--;
     FPRINTF (stdout, _("%24s: %-17s %4s   (%u connections in total)\n"),
              now_str,
              _("Disconnected from"),
              GNUNET_i2s (peer),
              monitor_connections_counter);
-    GNUNET_free (now_str);
   }
 }
 
@@ -169,6 +166,9 @@ static void
 run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
+  static const struct GNUNET_CORE_MessageHandler handlers[] = {
+    {NULL, 0, 0}
+  };
   if (args[0] != NULL)
   {
     FPRINTF (stderr, _("Invalid command line argument `%s'\n"), args[0]);
@@ -178,12 +178,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     GNUNET_CORE_iterate_peers (cfg, &connected_peer_callback, NULL);
   else
   {
-    const static struct GNUNET_CORE_MessageHandler handlers[] = {
-      {NULL, 0, 0}
-    };
-
     memset(&my_id, '\0', sizeof (my_id));
-
     ch = GNUNET_CORE_connect (cfg, NULL,
                               monitor_notify_startup,
                               monitor_notify_connect,