aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2011-02-24 12:15:41 +0000
committerNathan S. Evans <evans@in.tum.de>2011-02-24 12:15:41 +0000
commitd17a4a78bbc03c21907bb999bbb02676befe0640 (patch)
tree83cf11313d1d3739c43d3b8ff6edb482cb143d04 /src/testing
parent06721018e48be5f2249c2a0ca1eed80387af9209 (diff)
downloadgnunet-d17a4a78bbc03c21907bb999bbb02676befe0640.tar.gz
gnunet-d17a4a78bbc03c21907bb999bbb02676befe0640.zip
clique topology optimization, progress meter for connecting
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing_group.c231
1 files changed, 181 insertions, 50 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index 70fe3d4c8..5837930ee 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -89,7 +89,8 @@ typedef unsigned int (*GNUNET_TESTING_ConnectionProcessor) (struct
89 first, 89 first,
90 unsigned int 90 unsigned int
91 second, 91 second,
92 enum PeerLists list); 92 enum PeerLists list,
93 unsigned int check);
93 94
94 95
95/** 96/**
@@ -958,6 +959,25 @@ struct DFSContext
958 unsigned int current; 959 unsigned int current;
959}; 960};
960 961
962/**
963 * Simple struct to keep track of progress, and print a
964 * nice little percentage meter for long running tasks.
965 */
966struct ProgressMeter
967{
968 unsigned int total;
969
970 unsigned int modnum;
971
972 unsigned int dotnum;
973
974 unsigned int completed;
975
976 int print;
977
978 char *startup_string;
979};
980
961#if !OLD 981#if !OLD
962/** 982/**
963 * Convert unique ID to hash code. 983 * Convert unique ID to hash code.
@@ -990,6 +1010,102 @@ static struct GNUNET_CORE_MessageHandler no_handlers[] = { {NULL, 0, 0} };
990#endif 1010#endif
991 1011
992/** 1012/**
1013 * Create a meter to keep track of the progress of some task.
1014 *
1015 * @param total the total number of items to complete
1016 * @param start_string a string to prefix the meter with (if printing)
1017 * @param print GNUNET_YES to print the meter, GNUNET_NO to count
1018 * internally only
1019 *
1020 * @return the progress meter
1021 */
1022static struct ProgressMeter *
1023create_meter(unsigned int total, char * start_string, int print)
1024{
1025 struct ProgressMeter *ret;
1026 ret = GNUNET_malloc(sizeof(struct ProgressMeter));
1027 ret->print = print;
1028 ret->total = total;
1029 ret->modnum = total / 4;
1030 ret->dotnum = (total / 50) + 1;
1031 if (start_string != NULL)
1032 ret->startup_string = GNUNET_strdup(start_string);
1033 else
1034 ret->startup_string = GNUNET_strdup("");
1035
1036 return ret;
1037}
1038
1039/**
1040 * Update progress meter (increment by one).
1041 *
1042 * @param meter the meter to update and print info for
1043 *
1044 * @return GNUNET_YES if called the total requested,
1045 * GNUNET_NO if more items expected
1046 */
1047static int
1048update_meter(struct ProgressMeter *meter)
1049{
1050 if (meter->print == GNUNET_YES)
1051 {
1052 if (meter->completed % meter->modnum == 0)
1053 {
1054 if (meter->completed == 0)
1055 {
1056 fprintf(stdout, "%sProgress: [0%%", meter->startup_string);
1057 }
1058 else
1059 fprintf(stdout, "%d%%", (int) (((float) meter->completed
1060 / meter->total) * 100));
1061 }
1062 else if (meter->completed % meter->dotnum == 0)
1063 fprintf(stdout, ".");
1064
1065 if (meter->completed + 1 == meter->total)
1066 fprintf(stdout, "%d%%]\n", 100);
1067 fflush(stdout);
1068 }
1069 meter->completed++;
1070
1071 if (meter->completed == meter->total)
1072 return GNUNET_YES;
1073 if (meter->completed > meter->total)
1074 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Progress meter overflow!!\n");
1075 return GNUNET_NO;
1076}
1077
1078/**
1079 * Reset progress meter.
1080 *
1081 * @param meter the meter to reset
1082 *
1083 * @return GNUNET_YES if meter reset,
1084 * GNUNET_SYSERR on error
1085 */
1086static int
1087reset_meter(struct ProgressMeter *meter)
1088{
1089 if (meter == NULL)
1090 return GNUNET_SYSERR;
1091
1092 meter->completed = 0;
1093 return GNUNET_YES;
1094}
1095
1096/**
1097 * Release resources for meter
1098 *
1099 * @param meter the meter to free
1100 */
1101static void
1102free_meter(struct ProgressMeter *meter)
1103{
1104 GNUNET_free_non_null (meter->startup_string);
1105 GNUNET_free (meter);
1106}
1107
1108/**
993 * Get a topology from a string input. 1109 * Get a topology from a string input.
994 * 1110 *
995 * @param topology where to write the retrieved topology 1111 * @param topology where to write the retrieved topology
@@ -1345,6 +1461,7 @@ make_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
1345 * @param first index of the first peer 1461 * @param first index of the first peer
1346 * @param second index of the second peer 1462 * @param second index of the second peer
1347 * @param list the peer list to use 1463 * @param list the peer list to use
1464 * @param check UNUSED
1348 * 1465 *
1349 * @return the number of connections added (can be 0, 1 or 2) 1466 * @return the number of connections added (can be 0, 1 or 2)
1350 * 1467 *
@@ -1352,7 +1469,7 @@ make_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
1352static unsigned int 1469static unsigned int
1353remove_connections (struct GNUNET_TESTING_PeerGroup *pg, 1470remove_connections (struct GNUNET_TESTING_PeerGroup *pg,
1354 unsigned int first, unsigned int second, 1471 unsigned int first, unsigned int second,
1355 enum PeerLists list) 1472 enum PeerLists list, unsigned int check)
1356{ 1473{
1357 int removed; 1474 int removed;
1358#if OLD 1475#if OLD
@@ -1457,6 +1574,8 @@ remove_connections (struct GNUNET_TESTING_PeerGroup *pg,
1457 * @param first index of the first peer 1574 * @param first index of the first peer
1458 * @param second index of the second peer 1575 * @param second index of the second peer
1459 * @param list the list type that we should modify 1576 * @param list the list type that we should modify
1577 * @param check GNUNET_YES to check lists before adding
1578 * GNUNET_NO to force add
1460 * 1579 *
1461 * @return the number of connections added (can be 0, 1 or 2) 1580 * @return the number of connections added (can be 0, 1 or 2)
1462 * 1581 *
@@ -1464,7 +1583,8 @@ remove_connections (struct GNUNET_TESTING_PeerGroup *pg,
1464static unsigned int 1583static unsigned int
1465add_connections (struct GNUNET_TESTING_PeerGroup *pg, 1584add_connections (struct GNUNET_TESTING_PeerGroup *pg,
1466 unsigned int first, unsigned int second, 1585 unsigned int first, unsigned int second,
1467 enum PeerLists list) 1586 enum PeerLists list,
1587 unsigned int check)
1468{ 1588{
1469 int added; 1589 int added;
1470 int add_first; 1590 int add_first;
@@ -1521,26 +1641,29 @@ add_connections (struct GNUNET_TESTING_PeerGroup *pg,
1521 add_first = GNUNET_YES; 1641 add_first = GNUNET_YES;
1522 add_second = GNUNET_YES; 1642 add_second = GNUNET_YES;
1523 1643
1524 first_iter = *first_list; 1644 if (check == GNUNET_YES)
1525 while (first_iter != NULL)
1526 { 1645 {
1527 if (first_iter->index == second) 1646 first_iter = *first_list;
1647 while (first_iter != NULL)
1528 { 1648 {
1529 add_first = GNUNET_NO; 1649 if (first_iter->index == second)
1530 break; 1650 {
1651 add_first = GNUNET_NO;
1652 break;
1653 }
1654 first_iter = first_iter->next;
1531 } 1655 }
1532 first_iter = first_iter->next;
1533 }
1534 1656
1535 second_iter = *second_list; 1657 second_iter = *second_list;
1536 while (second_iter != NULL) 1658 while (second_iter != NULL)
1537 {
1538 if (second_iter->index == first)
1539 { 1659 {
1540 add_second = GNUNET_NO; 1660 if (second_iter->index == first)
1541 break; 1661 {
1662 add_second = GNUNET_NO;
1663 break;
1664 }
1665 second_iter = second_iter->next;
1542 } 1666 }
1543 second_iter = second_iter->next;
1544 } 1667 }
1545#else 1668#else
1546 if (GNUNET_NO == 1669 if (GNUNET_NO ==
@@ -1634,7 +1757,7 @@ create_scale_free (struct GNUNET_TESTING_PeerGroup *pg,
1634 GNUNET_assert (pg->total > 1); 1757 GNUNET_assert (pg->total > 1);
1635 1758
1636 /* Add a connection between the first two nodes */ 1759 /* Add a connection between the first two nodes */
1637 total_connections = proc (pg, 0, 1, list); 1760 total_connections = proc (pg, 0, 1, list, GNUNET_YES);
1638 1761
1639 for (outer_count = 1; outer_count < pg->total; outer_count++) 1762 for (outer_count = 1; outer_count < pg->total; outer_count++)
1640 { 1763 {
@@ -1659,7 +1782,7 @@ create_scale_free (struct GNUNET_TESTING_PeerGroup *pg,
1659 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1782 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1660 "Connecting peer %d to peer %d\n", outer_count, i); 1783 "Connecting peer %d to peer %d\n", outer_count, i);
1661#endif 1784#endif
1662 total_connections += proc (pg, outer_count, i, list); 1785 total_connections += proc (pg, outer_count, i, list, GNUNET_YES);
1663 } 1786 }
1664 } 1787 }
1665 } 1788 }
@@ -1786,7 +1909,7 @@ create_small_world_ring (struct GNUNET_TESTING_PeerGroup *pg,
1786 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1909 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
1787 pg->total); 1910 pg->total);
1788 } 1911 }
1789 smallWorldConnections += proc (pg, i, randomPeer, list); 1912 smallWorldConnections += proc (pg, i, randomPeer, list, GNUNET_YES);
1790 } 1913 }
1791 else 1914 else
1792 { 1915 {
@@ -1795,7 +1918,7 @@ create_small_world_ring (struct GNUNET_TESTING_PeerGroup *pg,
1795 { 1918 {
1796 nodeToConnect = nodeToConnect - pg->total; 1919 nodeToConnect = nodeToConnect - pg->total;
1797 } 1920 }
1798 connect_attempts += proc (pg, i, nodeToConnect, list); 1921 connect_attempts += proc (pg, i, nodeToConnect, list, GNUNET_YES);
1799 } 1922 }
1800 } 1923 }
1801 1924
@@ -1856,7 +1979,7 @@ create_nated_internet (struct GNUNET_TESTING_PeerGroup *pg,
1856 "Connecting peer %d to peer %d\n", 1979 "Connecting peer %d to peer %d\n",
1857 outer_count, inner_count); 1980 outer_count, inner_count);
1858#endif 1981#endif
1859 connect_attempts += proc (pg, outer_count, inner_count, list); 1982 connect_attempts += proc (pg, outer_count, inner_count, list, GNUNET_YES);
1860 } 1983 }
1861 } 1984 }
1862 } 1985 }
@@ -1915,8 +2038,8 @@ create_nated_internet_copy (struct GNUNET_TESTING_PeerGroup *pg,
1915 "Connecting peer %d to peer %d\n", 2038 "Connecting peer %d to peer %d\n",
1916 outer_count, inner_count); 2039 outer_count, inner_count);
1917#endif 2040#endif
1918 connect_attempts += proc (pg, outer_count, inner_count, list); 2041 connect_attempts += proc (pg, outer_count, inner_count, list, GNUNET_YES);
1919 add_connections(pg, outer_count, inner_count, ALLOWED); 2042 add_connections(pg, outer_count, inner_count, ALLOWED, GNUNET_YES);
1920 } 2043 }
1921 } 2044 }
1922 } 2045 }
@@ -2031,7 +2154,7 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg,
2031 else 2154 else
2032 nodeToConnect = i - cols + 1; 2155 nodeToConnect = i - cols + 1;
2033 2156
2034 connect_attempts += proc (pg, i, nodeToConnect, list); 2157 connect_attempts += proc (pg, i, nodeToConnect, list, GNUNET_YES);
2035 2158
2036 if (i < cols) 2159 if (i < cols)
2037 { 2160 {
@@ -2043,7 +2166,7 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg,
2043 nodeToConnect = i - cols; 2166 nodeToConnect = i - cols;
2044 2167
2045 if (nodeToConnect < pg->total) 2168 if (nodeToConnect < pg->total)
2046 connect_attempts += proc (pg, i, nodeToConnect, list); 2169 connect_attempts += proc (pg, i, nodeToConnect, list, GNUNET_YES);
2047 } 2170 }
2048 natLog = log (pg->total); 2171 natLog = log (pg->total);
2049#if VERBOSE_TESTING > 2 2172#if VERBOSE_TESTING > 2
@@ -2085,7 +2208,7 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg,
2085 ((double) UINT64_MAX); 2208 ((double) UINT64_MAX);
2086 /* If random < probability, then connect the two nodes */ 2209 /* If random < probability, then connect the two nodes */
2087 if (random < probability) 2210 if (random < probability)
2088 smallWorldConnections += proc (pg, j, k, list); 2211 smallWorldConnections += proc (pg, j, k, list, GNUNET_YES);
2089 2212
2090 } 2213 }
2091 } 2214 }
@@ -2153,7 +2276,7 @@ create_erdos_renyi (struct GNUNET_TESTING_PeerGroup *pg,
2153#endif 2276#endif
2154 if (temp_rand < probability) 2277 if (temp_rand < probability)
2155 { 2278 {
2156 connect_attempts += proc (pg, outer_count, inner_count, list); 2279 connect_attempts += proc (pg, outer_count, inner_count, list, GNUNET_YES);
2157 } 2280 }
2158 } 2281 }
2159 } 2282 }
@@ -2229,7 +2352,7 @@ create_2d_torus (struct GNUNET_TESTING_PeerGroup *pg,
2229 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2352 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2230 "Connecting peer %d to peer %d\n", i, nodeToConnect); 2353 "Connecting peer %d to peer %d\n", i, nodeToConnect);
2231#endif 2354#endif
2232 connect_attempts += proc (pg, i, nodeToConnect, list); 2355 connect_attempts += proc (pg, i, nodeToConnect, list, GNUNET_YES);
2233 2356
2234 /* Second connect to the node immediately above */ 2357 /* Second connect to the node immediately above */
2235 if (i < cols) 2358 if (i < cols)
@@ -2247,7 +2370,7 @@ create_2d_torus (struct GNUNET_TESTING_PeerGroup *pg,
2247 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2370 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2248 "Connecting peer %d to peer %d\n", i, nodeToConnect); 2371 "Connecting peer %d to peer %d\n", i, nodeToConnect);
2249#endif 2372#endif
2250 connect_attempts += proc (pg, i, nodeToConnect, list); 2373 connect_attempts += proc (pg, i, nodeToConnect, list, GNUNET_YES);
2251 } 2374 }
2252 2375
2253 } 2376 }
@@ -2264,20 +2387,25 @@ create_2d_torus (struct GNUNET_TESTING_PeerGroup *pg,
2264 * @param proc the connection processor to call to actually set 2387 * @param proc the connection processor to call to actually set
2265 * up connections between two peers 2388 * up connections between two peers
2266 * @param list the peer list to use 2389 * @param list the peer list to use
2390 * @param check does the connection processor need to check before
2391 * performing an action on the list?
2267 * 2392 *
2268 * @return the number of connections that were set up 2393 * @return the number of connections that were set up
2269 * 2394 *
2270 */ 2395 */
2271static unsigned int 2396static unsigned int
2272create_clique (struct GNUNET_TESTING_PeerGroup *pg, 2397create_clique (struct GNUNET_TESTING_PeerGroup *pg,
2273 GNUNET_TESTING_ConnectionProcessor proc, enum PeerLists list) 2398 GNUNET_TESTING_ConnectionProcessor proc,
2399 enum PeerLists list,
2400 unsigned int check)
2274{ 2401{
2275 unsigned int outer_count; 2402 unsigned int outer_count;
2276 unsigned int inner_count; 2403 unsigned int inner_count;
2277 int connect_attempts; 2404 int connect_attempts;
2278 2405 struct ProgressMeter *conn_meter;
2279 connect_attempts = 0; 2406 connect_attempts = 0;
2280 2407
2408 conn_meter = create_meter((((pg->total * pg->total) + pg->total) / 2) - pg->total, "Create Clique ", GNUNET_YES);
2281 for (outer_count = 0; outer_count < pg->total - 1; outer_count++) 2409 for (outer_count = 0; outer_count < pg->total - 1; outer_count++)
2282 { 2410 {
2283 for (inner_count = outer_count + 1; inner_count < pg->total; 2411 for (inner_count = outer_count + 1; inner_count < pg->total;
@@ -2288,10 +2416,13 @@ create_clique (struct GNUNET_TESTING_PeerGroup *pg,
2288 "Connecting peer %d to peer %d\n", 2416 "Connecting peer %d to peer %d\n",
2289 outer_count, inner_count); 2417 outer_count, inner_count);
2290#endif 2418#endif
2291 connect_attempts += proc (pg, outer_count, inner_count, list); 2419 connect_attempts += proc (pg, outer_count, inner_count, list, check);
2420 update_meter(conn_meter);
2292 } 2421 }
2293 } 2422 }
2294 2423 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Meter has %d left\n", conn_meter->total - conn_meter->completed);
2424 reset_meter(conn_meter);
2425 free_meter(conn_meter);
2295 return connect_attempts; 2426 return connect_attempts;
2296} 2427}
2297 2428
@@ -2353,7 +2484,7 @@ copy_allowed (struct GNUNET_TESTING_PeerGroup *pg,
2353 iter = pg->peers[count].allowed_peers_head; 2484 iter = pg->peers[count].allowed_peers_head;
2354 while (iter != NULL) 2485 while (iter != NULL)
2355 { 2486 {
2356 remove_connections(pg, count, iter->index, BLACKLIST); 2487 remove_connections(pg, count, iter->index, BLACKLIST, GNUNET_YES);
2357 //unblacklist_connections(pg, count, iter->index); 2488 //unblacklist_connections(pg, count, iter->index);
2358 iter = iter->next; 2489 iter = iter->next;
2359 } 2490 }
@@ -2394,7 +2525,7 @@ create_line (struct GNUNET_TESTING_PeerGroup *pg,
2394 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2525 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2395 "Connecting peer %d to peer %d\n", count, count + 1); 2526 "Connecting peer %d to peer %d\n", count, count + 1);
2396#endif 2527#endif
2397 connect_attempts += proc (pg, count, count + 1, list); 2528 connect_attempts += proc (pg, count, count + 1, list, GNUNET_YES);
2398 } 2529 }
2399 2530
2400 return connect_attempts; 2531 return connect_attempts;
@@ -2505,7 +2636,7 @@ create_from_file (struct GNUNET_TESTING_PeerGroup *pg,
2505 return connect_attempts; 2636 return connect_attempts;
2506 } 2637 }
2507 /* Assume file is written with first peer 1, but array index is 0 */ 2638 /* Assume file is written with first peer 1, but array index is 0 */
2508 connect_attempts += proc (pg, first_peer_index - 1, second_peer_index - 1, list); 2639 connect_attempts += proc (pg, first_peer_index - 1, second_peer_index - 1, list, GNUNET_YES);
2509 while((buf[count] != '\n') && (buf[count] != ',') && (count < frstat.st_size - 1)) 2640 while((buf[count] != '\n') && (buf[count] != ',') && (count < frstat.st_size - 1))
2510 count++; 2641 count++;
2511 if (buf[count] == '\n') 2642 if (buf[count] == '\n')
@@ -2567,11 +2698,11 @@ create_ring (struct GNUNET_TESTING_PeerGroup *pg,
2567 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2698 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2568 "Connecting peer %d to peer %d\n", count, count + 1); 2699 "Connecting peer %d to peer %d\n", count, count + 1);
2569#endif 2700#endif
2570 connect_attempts += proc (pg, count, count + 1, list); 2701 connect_attempts += proc (pg, count, count + 1, list, GNUNET_YES);
2571 } 2702 }
2572 2703
2573 /* Connect the last peer to the first peer */ 2704 /* Connect the last peer to the first peer */
2574 connect_attempts += proc (pg, pg->total - 1, 0, list); 2705 connect_attempts += proc (pg, pg->total - 1, 0, list, GNUNET_YES);
2575 2706
2576 return connect_attempts; 2707 return connect_attempts;
2577} 2708}
@@ -3608,7 +3739,7 @@ copy_allowed_topology (struct GNUNET_TESTING_PeerGroup *pg)
3608 while (iter != NULL) 3739 while (iter != NULL)
3609 { 3740 {
3610 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Creating connection between %d and %d\n", pg_iter, iter->index); 3741 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Creating connection between %d and %d\n", pg_iter, iter->index);
3611 total += add_connections(pg, pg_iter, iter->index, CONNECT); 3742 total += add_connections(pg, pg_iter, iter->index, CONNECT, GNUNET_NO);
3612 //total += add_actual_connections(pg, pg_iter, iter->index); 3743 //total += add_actual_connections(pg, pg_iter, iter->index);
3613 iter = iter->next; 3744 iter = iter->next;
3614 } 3745 }
@@ -3764,7 +3895,7 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg,
3764#if VERBOSE_TESTING 3895#if VERBOSE_TESTING
3765 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Creating clique topology\n")); 3896 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Creating clique topology\n"));
3766#endif 3897#endif
3767 num_connections = create_clique (pg, &add_connections, ALLOWED); 3898 num_connections = create_clique (pg, &add_connections, ALLOWED, GNUNET_NO);
3768 break; 3899 break;
3769 case GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING: 3900 case GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING:
3770#if VERBOSE_TESTING 3901#if VERBOSE_TESTING
@@ -3871,7 +4002,7 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg,
3871 4002
3872 /* Use the create clique method to initially set all connections as blacklisted. */ 4003 /* Use the create clique method to initially set all connections as blacklisted. */
3873 if ((restrict_topology != GNUNET_TESTING_TOPOLOGY_NONE) && (restrict_topology != GNUNET_TESTING_TOPOLOGY_FROM_FILE)) 4004 if ((restrict_topology != GNUNET_TESTING_TOPOLOGY_NONE) && (restrict_topology != GNUNET_TESTING_TOPOLOGY_FROM_FILE))
3874 create_clique (pg, &add_connections, BLACKLIST); 4005 create_clique (pg, &add_connections, BLACKLIST, GNUNET_NO);
3875 4006
3876 unblacklisted_connections = 0; 4007 unblacklisted_connections = 0;
3877 /* Un-blacklist connections as per the topology specified */ 4008 /* Un-blacklist connections as per the topology specified */
@@ -3883,7 +4014,7 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg,
3883 _("Blacklisting all but clique topology\n")); 4014 _("Blacklisting all but clique topology\n"));
3884#endif 4015#endif
3885 unblacklisted_connections = 4016 unblacklisted_connections =
3886 create_clique (pg, &remove_connections, BLACKLIST); 4017 create_clique (pg, &remove_connections, BLACKLIST, GNUNET_NO);
3887 break; 4018 break;
3888 case GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING: 4019 case GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING:
3889#if VERBOSE_TESTING 4020#if VERBOSE_TESTING
@@ -4201,7 +4332,7 @@ choose_random_connections (struct GNUNET_TESTING_PeerGroup *pg,
4201 UINT64_MAX)) / ((double) UINT64_MAX); 4332 UINT64_MAX)) / ((double) UINT64_MAX);
4202 if (random_number < percentage) 4333 if (random_number < percentage)
4203 { 4334 {
4204 add_connections(pg, pg_iter, conn_iter->index, WORKING_SET); 4335 add_connections(pg, pg_iter, conn_iter->index, WORKING_SET, GNUNET_YES);
4205 } 4336 }
4206 conn_iter = conn_iter->next; 4337 conn_iter = conn_iter->next;
4207 } 4338 }
@@ -4224,7 +4355,7 @@ choose_random_connections (struct GNUNET_TESTING_PeerGroup *pg,
4224 { 4355 {
4225 conn_iter = pg->peers[pg_iter].connect_peers_head; 4356 conn_iter = pg->peers[pg_iter].connect_peers_head;
4226 while (pg->peers[pg_iter].connect_peers_head != NULL) 4357 while (pg->peers[pg_iter].connect_peers_head != NULL)
4227 remove_connections(pg, pg_iter, pg->peers[pg_iter].connect_peers_head->index, CONNECT); 4358 remove_connections(pg, pg_iter, pg->peers[pg_iter].connect_peers_head->index, CONNECT, GNUNET_YES);
4228 4359
4229 pg->peers[pg_iter].connect_peers_head = pg->peers[pg_iter].connect_peers_working_set_head; 4360 pg->peers[pg_iter].connect_peers_head = pg->peers[pg_iter].connect_peers_working_set_head;
4230 pg->peers[pg_iter].connect_peers_tail = pg->peers[pg_iter].connect_peers_working_set_tail; 4361 pg->peers[pg_iter].connect_peers_tail = pg->peers[pg_iter].connect_peers_working_set_tail;
@@ -4357,7 +4488,7 @@ choose_minimum (struct GNUNET_TESTING_PeerGroup *pg, unsigned int num)
4357 conn_iter = conn_iter->next; 4488 conn_iter = conn_iter->next;
4358 /* We now have a random connection, connect it! */ 4489 /* We now have a random connection, connect it! */
4359 GNUNET_assert(conn_iter != NULL); 4490 GNUNET_assert(conn_iter != NULL);
4360 add_connections(pg, pg_iter, conn_iter->index, WORKING_SET); 4491 add_connections(pg, pg_iter, conn_iter->index, WORKING_SET, GNUNET_YES);
4361 } 4492 }
4362 } 4493 }
4363#else 4494#else
@@ -4396,7 +4527,7 @@ choose_minimum (struct GNUNET_TESTING_PeerGroup *pg, unsigned int num)
4396 for (pg_iter = 0; pg_iter < pg->total; pg_iter++) 4527 for (pg_iter = 0; pg_iter < pg->total; pg_iter++)
4397 { 4528 {
4398 while (pg->peers[pg_iter].connect_peers_head != NULL) 4529 while (pg->peers[pg_iter].connect_peers_head != NULL)
4399 remove_connections(pg, pg_iter, pg->peers[pg_iter].connect_peers_head->index, CONNECT); 4530 remove_connections(pg, pg_iter, pg->peers[pg_iter].connect_peers_head->index, CONNECT, GNUNET_YES);
4400 4531
4401 pg->peers[pg_iter].connect_peers_head = pg->peers[pg_iter].connect_peers_working_set_head; 4532 pg->peers[pg_iter].connect_peers_head = pg->peers[pg_iter].connect_peers_working_set_head;
4402 pg->peers[pg_iter].connect_peers_tail = pg->peers[pg_iter].connect_peers_working_set_tail; 4533 pg->peers[pg_iter].connect_peers_tail = pg->peers[pg_iter].connect_peers_working_set_tail;
@@ -4572,8 +4703,8 @@ perform_dfs (struct GNUNET_TESTING_PeerGroup *pg, unsigned int num)
4572 temp_count++; 4703 temp_count++;
4573 } 4704 }
4574 GNUNET_assert(peer_iter != NULL); 4705 GNUNET_assert(peer_iter != NULL);
4575 add_connections(pg, starting_peer, peer_iter->index, WORKING_SET); 4706 add_connections(pg, starting_peer, peer_iter->index, WORKING_SET, GNUNET_NO);
4576 remove_connections(pg, starting_peer, peer_iter->index, CONNECT); 4707 remove_connections(pg, starting_peer, peer_iter->index, CONNECT, GNUNET_YES);
4577 starting_peer = peer_iter->index; 4708 starting_peer = peer_iter->index;
4578 dfs_count++; 4709 dfs_count++;
4579 } 4710 }
@@ -5077,7 +5208,7 @@ GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg,
5077 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 5208 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5078 _("Creating clique CONNECT topology\n")); 5209 _("Creating clique CONNECT topology\n"));
5079#endif 5210#endif
5080 create_clique (pg, &add_connections, CONNECT); 5211 create_clique (pg, &add_connections, CONNECT, GNUNET_NO);
5081 break; 5212 break;
5082 case GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING: 5213 case GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING:
5083#if VERBOSE_TOPOLOGY 5214#if VERBOSE_TOPOLOGY