Check that you are not present in trail twice
[oweals/gnunet.git] / src / transport / test_transport_api_blacklisting.c
index 7186d1b3f35be90e6fa7e35bb3ebbea01644ee89..2c3ab125a010ee03ce8811d0470ed9e1c0ff27ab 100644 (file)
 #include "gnunet_transport_service.h"
 #include "transport-testing.h"
 
-struct PeerContext *p1;
+static struct PeerContext *p1;
 
-struct PeerContext *p2;
+static struct PeerContext *p2;
 
 static GNUNET_TRANSPORT_TESTING_ConnectRequest cc;
 
-struct GNUNET_TRANSPORT_TransmitHandle *th;
+static struct GNUNET_TRANSPORT_TransmitHandle *th;
 
-struct GNUNET_TRANSPORT_TESTING_handle *tth;
+static struct GNUNET_TRANSPORT_TESTING_handle *tth;
 
 /**
  * How long until we give up on transmitting the message?
@@ -58,9 +58,9 @@ static int connected;
 static int blacklist_request_p1;
 static int blacklist_request_p2;
 
-struct GNUNET_TRANSPORT_Blacklist * blacklist_p1;
+static struct GNUNET_TRANSPORT_Blacklist * blacklist_p1;
 
-struct GNUNET_TRANSPORT_Blacklist * blacklist_p2;
+static struct GNUNET_TRANSPORT_Blacklist * blacklist_p2;
 
 static GNUNET_SCHEDULER_TaskIdentifier die_task;
 
@@ -268,11 +268,13 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
               p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s);
   GNUNET_free (receiver_s);
 
-  th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, 0,
+  th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id,
+                                               TEST_MESSAGE_SIZE,
                                                TIMEOUT_TRANSMIT, &notify_ready,
                                                p1);
 }
 
+
 static void
 notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
 {
@@ -282,6 +284,7 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
   struct PeerContext *p = cls;
   struct PeerContext *t = NULL;
 
+  connected = GNUNET_YES;
   if (0 == memcmp (peer, &p1->id, sizeof (struct GNUNET_PeerIdentity)))
     t = p1;
   if (0 == memcmp (peer, &p2->id, sizeof (struct GNUNET_PeerIdentity)))
@@ -314,12 +317,14 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
   th = NULL;
 }
 
+
 static void
 testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
 {
   cc = NULL;
   char *p1_c = GNUNET_strdup (GNUNET_i2s (&p1->id));
 
+  connected = GNUNET_YES;
   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);
@@ -330,13 +335,18 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls)
 }
 
 
-int blacklist_cb (void *cls,
-                 const struct
-                 GNUNET_PeerIdentity * pid)
+static int
+blacklist_cb (void *cls,
+              const struct
+              GNUNET_PeerIdentity * pid)
 {
   struct PeerContext * p = cls;
   int res = GNUNET_SYSERR;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer  %u : Blacklist request for peer `%s'\n", p->no, GNUNET_i2s (pid));
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Peer  %u : Blacklist request for peer `%s'\n",
+              p->no,
+              GNUNET_i2s (pid));
 
   if (p == p1)
   {