[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25512 - in gnunet/src: dht testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25512 - in gnunet/src: dht testbed |
Date: |
Mon, 17 Dec 2012 14:11:54 +0100 |
Author: harsha
Date: 2012-12-17 14:11:54 +0100 (Mon, 17 Dec 2012)
New Revision: 25512
Modified:
gnunet/src/dht/test_dht_multipeer_topology.dat
gnunet/src/testbed/testbed_api_topology.c
Log:
- warn if connecting a peer to itself
- peer indices in overlay topology file start with index 0
Modified: gnunet/src/dht/test_dht_multipeer_topology.dat
===================================================================
--- gnunet/src/dht/test_dht_multipeer_topology.dat 2012-12-17 12:48:00 UTC
(rev 25511)
+++ gnunet/src/dht/test_dht_multipeer_topology.dat 2012-12-17 13:11:54 UTC
(rev 25512)
@@ -1,11 +1,11 @@
-1:2|7|9
-2:3|8|10
+0:1|6|8
+1:2|6|8
+2:0|3|8
3:1|4|9
-4:2|5|10
+4:0|2|5
5:1|3|6
6:2|4|7
7:3|5|8
8:4|6|9
-9:5|7|10
-10:1|6|8
+9:0|5|7
Modified: gnunet/src/testbed/testbed_api_topology.c
===================================================================
--- gnunet/src/testbed/testbed_api_topology.c 2012-12-17 12:48:00 UTC (rev
25511)
+++ gnunet/src/testbed/testbed_api_topology.c 2012-12-17 13:11:54 UTC (rev
25512)
@@ -266,11 +266,11 @@
/**
- * Populates the OverlayLink structure
+ * Populates the OverlayLink structure.
*
* @param link the OverlayLink
- * @param A the peer A
- * @param B the peer B
+ * @param A the peer A. Should be different from B
+ * @param B the peer B. Should be different from A
* @param tc the TopologyContext
* @return
*/
@@ -280,6 +280,8 @@
uint32_t B,
struct TopologyContext *tc)
{
+ GNUNET_assert (A != B);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting peer %u to %u\n", B, A);
link->A = A;
link->B = B;
link->op = NULL;
@@ -633,7 +635,7 @@
if (tc->num_peers <= peer_id)
{
LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Topology file need more peers than the given ones\n"),
+ _("Topology file needs more peers than given ones\n"),
filename);
goto _exit;
}
@@ -658,17 +660,23 @@
if (tc->num_peers <= other_peer_id)
{
LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Topology file need more peers than the given ones\n"),
+ _("Topology file needs more peers than given ones\n"),
filename);
goto _exit;
}
- tc->link_array_size++;
- tc->link_array = GNUNET_realloc (tc->link_array,
- sizeof (struct OverlayLink) *
- tc->link_array_size);
- offset += end - &data[offset];
- make_link (&tc->link_array[tc->link_array_size - 1], peer_id,
- other_peer_id, tc);
+ if (peer_id != other_peer_id)
+ {
+ tc->link_array_size++;
+ tc->link_array = GNUNET_realloc (tc->link_array,
+ sizeof (struct OverlayLink) *
+ tc->link_array_size);
+ offset += end - &data[offset];
+ make_link (&tc->link_array[tc->link_array_size - 1], peer_id,
+ other_peer_id, tc);
+ }
+ else
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ _("Ignoring to connect peer %u to peer %u\n"), peer_id,
other_peer_id);
while (('\n' != data[offset]) && ('|' != data[offset])
&& (offset < fs))
offset++;
@@ -689,7 +697,7 @@
if (GNUNET_OK != status)
{
LOG (GNUNET_ERROR_TYPE_WARNING,
- "Removing and link data read from the file\n");
+ "Removing link data read from the file\n");
tc->link_array_size = 0;
GNUNET_free_non_null (tc->link_array);
tc->link_array = NULL;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25512 - in gnunet/src: dht testbed,
gnunet <=