-doxygen
[oweals/gnunet.git] / src / transport / test_transport_api_bidirectional_connect.c
index 4decf05317711a6d818fee4eaee6e8e752167789..5bc7d091bd081d53bd4489424b845a00e5428d66 100644 (file)
@@ -144,12 +144,11 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
   GNUNET_assert (t != NULL);
 
   char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
-
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Peer %u (`%4s') received message of type %d and size %u size from peer %u (`%4s')!\n",
               p->no, ps, ntohs (message->type), ntohs (message->size), t->no,
               GNUNET_i2s (&t->id));
-
+  GNUNET_free (ps);
   if ((MTYPE == ntohs (message->type)) &&
       (sizeof (struct GNUNET_MessageHeader) == ntohs (message->size)))
   {
@@ -241,7 +240,7 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
 
   char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
 
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Peer %u (`%4s'): peer %u (`%s') connected to me!\n", p->no, ps,
               t->no, GNUNET_i2s (peer));
   GNUNET_free (ps);
@@ -254,21 +253,23 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
   struct PeerContext *p = cls;
   char *ps = GNUNET_strdup (GNUNET_i2s (&p->id));
 
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Peer %u (`%4s'): peer (`%s') disconnected from me!\n", p->no, ps,
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Peer %u (`%4s'): peer (`%s') disconnected from me!\n",
+              p->no, ps,
               GNUNET_i2s (peer));
+  GNUNET_free (ps);
 
   if (GNUNET_SCHEDULER_NO_TASK != send_task)
   {
-
-       GNUNET_SCHEDULER_cancel(send_task);
-       GNUNET_break (0);
-               send_task = GNUNET_SCHEDULER_NO_TASK;
+    GNUNET_SCHEDULER_cancel(send_task);
+    GNUNET_break (0);
+    send_task = GNUNET_SCHEDULER_NO_TASK;
   }
-
-  if (th != NULL)
+  if (NULL != th)
+  {
     GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
-  th = NULL;
+    th = NULL;
+  }
 }
 
 
@@ -276,15 +277,12 @@ static void
 testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
 {
        static int connected = GNUNET_NO;
-       GNUNET_break (0);
   if ((cls == cc1) && (NULL != cc2))
   {
-       GNUNET_break (0);
     GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc2);
   }
   if ((cls == cc2) && (NULL != cc1))
   {
-       GNUNET_break (0);
     GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc1);
   }
   cc1 = NULL;
@@ -298,7 +296,6 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected: %u (%s) <-> %u (%s)\n",
               p1->no, p1_c, p2->no, GNUNET_i2s (&p2->id));
   GNUNET_free (p1_c);
-GNUNET_break (0);
   send_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &sendtask, NULL);
 }
 
@@ -310,7 +307,9 @@ start_cb (struct PeerContext *p, void *cls)
 
   started++;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %u (`%s') started\n", p->no,
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Peer %u (`%s') started\n",
+              p->no,
               GNUNET_i2s (&p->id));
 
   if (started != 2)
@@ -321,7 +320,7 @@ start_cb (struct PeerContext *p, void *cls)
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Test tries to connect peer %u (`%s') <-> peer %u (`%s')\n",
               p1->no, sender_c, p2->no, GNUNET_i2s (&p2->id));
-
+  GNUNET_free (sender_c);
   cc1 =
       GNUNET_TRANSPORT_TESTING_connect_peers (tth, p2, p1, &testing_connect_cb,
                                               cc1);
@@ -330,6 +329,7 @@ start_cb (struct PeerContext *p, void *cls)
                                               cc2);
 }
 
+
 static void
 run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)