diff options
-rw-r--r-- | src/dht/test_dht_multipeer_topology.dat | 10 | ||||
-rw-r--r-- | src/testbed/testbed_api_topology.c | 34 |
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 @@ | |||
1 | 1:2|7|9 | 1 | 0:1|6|8 |
2 | 2:3|8|10 | 2 | 1:2|6|8 |
3 | 2:0|3|8 | ||
3 | 3:1|4|9 | 4 | 3:1|4|9 |
4 | 4:2|5|10 | 5 | 4:0|2|5 |
5 | 5:1|3|6 | 6 | 5:1|3|6 |
6 | 6:2|4|7 | 7 | 6:2|4|7 |
7 | 7:3|5|8 | 8 | 7:3|5|8 |
8 | 8:4|6|9 | 9 | 8:4|6|9 |
9 | 9:5|7|10 | 10 | 9:0|5|7 |
10 | 10: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; |