dhtlog updates
[oweals/gnunet.git] / src / dv / test_transport_api_dv.c
index 587ceb65e9fb6296ee6b1508ba11456c363cf9af..2449663007ee8bfcf2cd9e869f6fdaa92c076aa5 100644 (file)
@@ -4,7 +4,7 @@
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
@@ -25,7 +25,7 @@
 #include "gnunet_testing_lib.h"
 #include "gnunet_core_service.h"
 
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 #define TEST_ALL GNUNET_NO
 
@@ -198,7 +198,6 @@ finish_testing ()
   struct PeerContext *free_peer_pos;
   struct TestMessageContext *pos;
   struct TestMessageContext *free_pos;
-  int count;
 
 #if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -215,7 +214,6 @@ finish_testing ()
     }
   all_peers = NULL;
 
-  count = 0;
   pos = test_messages;
   while (pos != NULL)
     {
@@ -534,14 +532,14 @@ init_notify_peer1 (void *cls,
    * Connect to the receiving peer
    */
   pos->peer2handle = GNUNET_CORE_connect (sched,
-                       pos->peer2->cfg,
-                       TIMEOUT,
-                       pos,
-                       &init_notify_peer2,
-                       NULL,
-                       NULL,
-                       NULL,
-                       GNUNET_YES, NULL, GNUNET_YES, handlers);
+                                         pos->peer2->cfg,
+                                         TIMEOUT,
+                                         pos,
+                                         &init_notify_peer2,
+                                         NULL,
+                                         NULL,
+                                         NULL, NULL,
+                                         GNUNET_YES, NULL, GNUNET_YES, handlers);
 
 }
 
@@ -578,7 +576,7 @@ send_test_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
                                           TIMEOUT,
                                           pos,
                                           &init_notify_peer1,
-                                          NULL,
+                                          NULL, NULL,
                                           NULL,
                                           NULL,
                                           GNUNET_NO, NULL, GNUNET_NO, no_handlers);
@@ -720,7 +718,7 @@ topology_callback (void *cls,
     {
 #if VERBOSE
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Created %d total connections, which is our target number!  Calling send messages.\n",
+                  "Created %u total connections, which is our target number!  Calling send messages.\n",
                   total_connections);
 #endif
 
@@ -834,6 +832,7 @@ static void all_connect_handler (void *cls,
   if (second_daemon == NULL)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Couldn't find second peer!\n");
+      GNUNET_free(second_shortname);
       return;
     }
 #if !TEST_ALL
@@ -893,7 +892,7 @@ peers_started_callback (void *cls,
   GNUNET_assert(GNUNET_SYSERR != GNUNET_CONTAINER_multihashmap_put(peer_daemon_hash, &id->hashPubKey, d, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
 
   new_peer = GNUNET_malloc(sizeof(struct PeerContext));
-  new_peer->peer_handle = GNUNET_CORE_connect(sched, cfg, GNUNET_TIME_UNIT_FOREVER_REL, d, NULL, &all_connect_handler, NULL, NULL, GNUNET_NO, NULL, GNUNET_NO, no_handlers);
+  new_peer->peer_handle = GNUNET_CORE_connect(sched, cfg, GNUNET_TIME_UNIT_FOREVER_REL, d, NULL, &all_connect_handler, NULL, NULL, NULL, GNUNET_NO, NULL, GNUNET_NO, no_handlers);
   new_peer->daemon = d;
   new_peer->next = all_peers;
   all_peers = new_peer;
@@ -1059,6 +1058,7 @@ run (void *cls,
 
   main_cfg = cfg;
 
+  GNUNET_assert(num_peers > 0 && num_peers < (unsigned int)-1);
   peers_left = num_peers;
 
   /* Set up a task to end testing if peer start fails */