aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dht/test_dht_multipeer_topology.dat10
-rw-r--r--src/testbed/testbed_api_topology.c34
2 files changed, 26 insertions, 18 deletions
diff --git a/src/dht/test_dht_multipeer_topology.dat b/src/dht/test_dht_multipeer_topology.dat
index b671f8bbd..ab28af729 100644
--- a/src/dht/test_dht_multipeer_topology.dat
+++ b/src/dht/test_dht_multipeer_topology.dat
@@ -1,11 +1,11 @@
11:2|7|9 10:1|6|8
22:3|8|10 21:2|6|8
32:0|3|8
33:1|4|9 43:1|4|9
44:2|5|10 54:0|2|5
55:1|3|6 65:1|3|6
66:2|4|7 76:2|4|7
77:3|5|8 87:3|5|8
88:4|6|9 98:4|6|9
99:5|7|10 109:0|5|7
1010:1|6|8
11 11
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c
index fd37d6572..0b949d3aa 100644
--- a/src/testbed/testbed_api_topology.c
+++ b/src/testbed/testbed_api_topology.c
@@ -266,11 +266,11 @@ oprelease_overlay_configure_topology (void *cls)
266 266
267 267
268/** 268/**
269 * Populates the OverlayLink structure 269 * Populates the OverlayLink structure.
270 * 270 *
271 * @param link the OverlayLink 271 * @param link the OverlayLink
272 * @param A the peer A 272 * @param A the peer A. Should be different from B
273 * @param B the peer B 273 * @param B the peer B. Should be different from A
274 * @param tc the TopologyContext 274 * @param tc the TopologyContext
275 * @return 275 * @return
276 */ 276 */
@@ -280,6 +280,8 @@ make_link (struct OverlayLink *link,
280 uint32_t B, 280 uint32_t B,
281 struct TopologyContext *tc) 281 struct TopologyContext *tc)
282{ 282{
283 GNUNET_assert (A != B);
284 LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting peer %u to %u\n", B, A);
283 link->A = A; 285 link->A = A;
284 link->B = B; 286 link->B = B;
285 link->op = NULL; 287 link->op = NULL;
@@ -633,7 +635,7 @@ gen_topo_from_file (struct TopologyContext *tc, const char *filename)
633 if (tc->num_peers <= peer_id) 635 if (tc->num_peers <= peer_id)
634 { 636 {
635 LOG (GNUNET_ERROR_TYPE_ERROR, 637 LOG (GNUNET_ERROR_TYPE_ERROR,
636 _("Topology file need more peers than the given ones\n"), 638 _("Topology file needs more peers than given ones\n"),
637 filename); 639 filename);
638 goto _exit; 640 goto _exit;
639 } 641 }
@@ -658,17 +660,23 @@ gen_topo_from_file (struct TopologyContext *tc, const char *filename)
658 if (tc->num_peers <= other_peer_id) 660 if (tc->num_peers <= other_peer_id)
659 { 661 {
660 LOG (GNUNET_ERROR_TYPE_ERROR, 662 LOG (GNUNET_ERROR_TYPE_ERROR,
661 _("Topology file need more peers than the given ones\n"), 663 _("Topology file needs more peers than given ones\n"),
662 filename); 664 filename);
663 goto _exit; 665 goto _exit;
664 } 666 }
665 tc->link_array_size++; 667 if (peer_id != other_peer_id)
666 tc->link_array = GNUNET_realloc (tc->link_array, 668 {
667 sizeof (struct OverlayLink) * 669 tc->link_array_size++;
668 tc->link_array_size); 670 tc->link_array = GNUNET_realloc (tc->link_array,
669 offset += end - &data[offset]; 671 sizeof (struct OverlayLink) *
670 make_link (&tc->link_array[tc->link_array_size - 1], peer_id, 672 tc->link_array_size);
671 other_peer_id, tc); 673 offset += end - &data[offset];
674 make_link (&tc->link_array[tc->link_array_size - 1], peer_id,
675 other_peer_id, tc);
676 }
677 else
678 LOG (GNUNET_ERROR_TYPE_WARNING,
679 _("Ignoring to connect peer %u to peer %u\n"), peer_id, other_peer_id);
672 while (('\n' != data[offset]) && ('|' != data[offset]) 680 while (('\n' != data[offset]) && ('|' != data[offset])
673 && (offset < fs)) 681 && (offset < fs))
674 offset++; 682 offset++;
@@ -689,7 +697,7 @@ gen_topo_from_file (struct TopologyContext *tc, const char *filename)
689 if (GNUNET_OK != status) 697 if (GNUNET_OK != status)
690 { 698 {
691 LOG (GNUNET_ERROR_TYPE_WARNING, 699 LOG (GNUNET_ERROR_TYPE_WARNING,
692 "Removing and link data read from the file\n"); 700 "Removing link data read from the file\n");
693 tc->link_array_size = 0; 701 tc->link_array_size = 0;
694 GNUNET_free_non_null (tc->link_array); 702 GNUNET_free_non_null (tc->link_array);
695 tc->link_array = NULL; 703 tc->link_array = NULL;