diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-06-17 15:29:40 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-06-17 15:29:40 +0000 |
commit | 7f06c82295b46f1c8f1f3b16d5e979abea3e5660 (patch) | |
tree | 2f30ab82eb3d4bdde81ca75b5fb5fccf4abe79da /src/testing | |
parent | 344da83a5a06b4b4db4eb68972ee49333369f2db (diff) | |
download | gnunet-7f06c82295b46f1c8f1f3b16d5e979abea3e5660.tar.gz gnunet-7f06c82295b46f1c8f1f3b16d5e979abea3e5660.zip |
some testing changes, including an api change that likely breaks things for others
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_testing_topology.c | 11 | ||||
-rw-r--r-- | src/testing/testing.c | 21 | ||||
-rw-r--r-- | src/testing/testing_group.c | 155 |
3 files changed, 169 insertions, 18 deletions
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index dfc59ab74..d7bb836e9 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "gnunet_testing_lib.h" | 25 | #include "gnunet_testing_lib.h" |
26 | #include "gnunet_core_service.h" | 26 | #include "gnunet_core_service.h" |
27 | 27 | ||
28 | #define VERBOSE GNUNET_NO | 28 | #define VERBOSE GNUNET_YES |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * How long until we fail the whole testcase? | 31 | * How long until we fail the whole testcase? |
@@ -445,6 +445,7 @@ void | |||
445 | topology_callback (void *cls, | 445 | topology_callback (void *cls, |
446 | const struct GNUNET_PeerIdentity *first, | 446 | const struct GNUNET_PeerIdentity *first, |
447 | const struct GNUNET_PeerIdentity *second, | 447 | const struct GNUNET_PeerIdentity *second, |
448 | uint32_t distance, | ||
448 | const struct GNUNET_CONFIGURATION_Handle *first_cfg, | 449 | const struct GNUNET_CONFIGURATION_Handle *first_cfg, |
449 | const struct GNUNET_CONFIGURATION_Handle *second_cfg, | 450 | const struct GNUNET_CONFIGURATION_Handle *second_cfg, |
450 | struct GNUNET_TESTING_Daemon *first_daemon, | 451 | struct GNUNET_TESTING_Daemon *first_daemon, |
@@ -699,7 +700,7 @@ run (void *cls, | |||
699 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 700 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
700 | "Invalid connect topology `%s' given for section %s option %s\n", connect_topology_str, "TESTING", "CONNECT_TOPOLOGY"); | 701 | "Invalid connect topology `%s' given for section %s option %s\n", connect_topology_str, "TESTING", "CONNECT_TOPOLOGY"); |
701 | } | 702 | } |
702 | 703 | GNUNET_free_non_null(connect_topology_str); | |
703 | if ((GNUNET_YES == | 704 | if ((GNUNET_YES == |
704 | GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "connect_topology_option", | 705 | GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "connect_topology_option", |
705 | &connect_topology_option_str)) && (GNUNET_NO == GNUNET_TESTING_topology_option_get(&connect_topology_option, connect_topology_option_str))) | 706 | &connect_topology_option_str)) && (GNUNET_NO == GNUNET_TESTING_topology_option_get(&connect_topology_option, connect_topology_option_str))) |
@@ -708,7 +709,7 @@ run (void *cls, | |||
708 | "Invalid connect topology option `%s' given for section %s option %s\n", connect_topology_option_str, "TESTING", "CONNECT_TOPOLOGY_OPTION"); | 709 | "Invalid connect topology option `%s' given for section %s option %s\n", connect_topology_option_str, "TESTING", "CONNECT_TOPOLOGY_OPTION"); |
709 | connect_topology_option = GNUNET_TESTING_TOPOLOGY_OPTION_ALL; /* Defaults to NONE, set to ALL */ | 710 | connect_topology_option = GNUNET_TESTING_TOPOLOGY_OPTION_ALL; /* Defaults to NONE, set to ALL */ |
710 | } | 711 | } |
711 | 712 | GNUNET_free_non_null(connect_topology_option_str); | |
712 | if (GNUNET_YES == | 713 | if (GNUNET_YES == |
713 | GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "connect_topology_option_modifier", | 714 | GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "connect_topology_option_modifier", |
714 | &connect_topology_option_modifier_string)) | 715 | &connect_topology_option_modifier_string)) |
@@ -730,11 +731,13 @@ run (void *cls, | |||
730 | 731 | ||
731 | if ((GNUNET_YES == | 732 | if ((GNUNET_YES == |
732 | GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "blacklist_topology", | 733 | GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "blacklist_topology", |
733 | & blacklist_topology_str)) && (GNUNET_NO == GNUNET_TESTING_topology_get(&blacklist_topology, blacklist_topology_str))) | 734 | &blacklist_topology_str)) && (GNUNET_NO == GNUNET_TESTING_topology_get(&blacklist_topology, blacklist_topology_str))) |
734 | { | 735 | { |
735 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 736 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
736 | "Invalid topology `%s' given for section %s option %s\n", topology_str, "TESTING", "BLACKLIST_TOPOLOGY"); | 737 | "Invalid topology `%s' given for section %s option %s\n", topology_str, "TESTING", "BLACKLIST_TOPOLOGY"); |
737 | } | 738 | } |
739 | GNUNET_free_non_null(topology_str); | ||
740 | GNUNET_free_non_null(blacklist_topology_str); | ||
738 | 741 | ||
739 | if (GNUNET_SYSERR == | 742 | if (GNUNET_SYSERR == |
740 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers", | 743 | GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers", |
diff --git a/src/testing/testing.c b/src/testing/testing.c index 0c650d313..5b36fc380 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -1158,11 +1158,15 @@ struct ConnectContext | |||
1158 | */ | 1158 | */ |
1159 | struct GNUNET_TIME_Relative timeout_hello; | 1159 | struct GNUNET_TIME_Relative timeout_hello; |
1160 | 1160 | ||
1161 | |||
1162 | /** | 1161 | /** |
1163 | * Was the connection attempt successful? | 1162 | * Was the connection attempt successful? |
1164 | */ | 1163 | */ |
1165 | int connected; | 1164 | int connected; |
1165 | |||
1166 | /** | ||
1167 | * The distance between the two connected peers | ||
1168 | */ | ||
1169 | uint32_t distance; | ||
1166 | }; | 1170 | }; |
1167 | 1171 | ||
1168 | 1172 | ||
@@ -1210,7 +1214,7 @@ notify_connect_result (void *cls, | |||
1210 | { | 1214 | { |
1211 | if (ctx->cb != NULL) | 1215 | if (ctx->cb != NULL) |
1212 | { | 1216 | { |
1213 | ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, ctx->d1->cfg, | 1217 | ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, ctx->distance, ctx->d1->cfg, |
1214 | ctx->d2->cfg, ctx->d1, ctx->d2, NULL); | 1218 | ctx->d2->cfg, ctx->d1, ctx->d2, NULL); |
1215 | } | 1219 | } |
1216 | } | 1220 | } |
@@ -1234,7 +1238,7 @@ notify_connect_result (void *cls, | |||
1234 | { | 1238 | { |
1235 | if (ctx->cb != NULL) | 1239 | if (ctx->cb != NULL) |
1236 | { | 1240 | { |
1237 | ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, ctx->d1->cfg, | 1241 | ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, 0, ctx->d1->cfg, |
1238 | ctx->d2->cfg, ctx->d1, ctx->d2, | 1242 | ctx->d2->cfg, ctx->d1, ctx->d2, |
1239 | _("Peers failed to connect")); | 1243 | _("Peers failed to connect")); |
1240 | } | 1244 | } |
@@ -1266,6 +1270,7 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity * peer, struct GNUNE | |||
1266 | if (memcmp(&ctx->d2->id, peer, sizeof(struct GNUNET_PeerIdentity)) == 0) | 1270 | if (memcmp(&ctx->d2->id, peer, sizeof(struct GNUNET_PeerIdentity)) == 0) |
1267 | { | 1271 | { |
1268 | ctx->connected = GNUNET_YES; | 1272 | ctx->connected = GNUNET_YES; |
1273 | ctx->distance = distance; | ||
1269 | GNUNET_SCHEDULER_cancel(ctx->d1->sched, ctx->timeout_task); | 1274 | GNUNET_SCHEDULER_cancel(ctx->d1->sched, ctx->timeout_task); |
1270 | ctx->timeout_task = GNUNET_SCHEDULER_add_now (ctx->d1->sched, | 1275 | ctx->timeout_task = GNUNET_SCHEDULER_add_now (ctx->d1->sched, |
1271 | ¬ify_connect_result, | 1276 | ¬ify_connect_result, |
@@ -1319,7 +1324,7 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, | |||
1319 | if ((d1->running == GNUNET_NO) || (d2->running == GNUNET_NO)) | 1324 | if ((d1->running == GNUNET_NO) || (d2->running == GNUNET_NO)) |
1320 | { | 1325 | { |
1321 | if (NULL != cb) | 1326 | if (NULL != cb) |
1322 | cb (cb_cls, &d1->id, &d2->id, d1->cfg, d2->cfg, d1, d2, | 1327 | cb (cb_cls, &d1->id, &d2->id, 0, d1->cfg, d2->cfg, d1, d2, |
1323 | _("Peers are not fully running yet, can not connect!\n")); | 1328 | _("Peers are not fully running yet, can not connect!\n")); |
1324 | return; | 1329 | return; |
1325 | } | 1330 | } |
@@ -1351,7 +1356,7 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, | |||
1351 | { | 1356 | { |
1352 | GNUNET_free (ctx); | 1357 | GNUNET_free (ctx); |
1353 | if (NULL != cb) | 1358 | if (NULL != cb) |
1354 | cb (cb_cls, &d1->id, &d2->id, d1->cfg, d2->cfg, d1, d2, | 1359 | cb (cb_cls, &d1->id, &d2->id, 0, d1->cfg, d2->cfg, d1, d2, |
1355 | _("Failed to connect to core service of first peer!\n")); | 1360 | _("Failed to connect to core service of first peer!\n")); |
1356 | return; | 1361 | return; |
1357 | } | 1362 | } |
@@ -1372,7 +1377,7 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, | |||
1372 | GNUNET_CORE_disconnect(ctx->d1core); | 1377 | GNUNET_CORE_disconnect(ctx->d1core); |
1373 | GNUNET_free (ctx); | 1378 | GNUNET_free (ctx); |
1374 | if (NULL != cb) | 1379 | if (NULL != cb) |
1375 | cb (cb_cls, &d1->id, &d2->id, d1->cfg, d2->cfg, d1, d2, | 1380 | cb (cb_cls, &d1->id, &d2->id, 0, d1->cfg, d2->cfg, d1, d2, |
1376 | _("Failed to connect to transport service!\n")); | 1381 | _("Failed to connect to transport service!\n")); |
1377 | return; | 1382 | return; |
1378 | } | 1383 | } |
@@ -1412,7 +1417,7 @@ reattempt_daemons_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext | |||
1412 | if (ctx->d1core == NULL) | 1417 | if (ctx->d1core == NULL) |
1413 | { | 1418 | { |
1414 | if (NULL != ctx->cb) | 1419 | if (NULL != ctx->cb) |
1415 | ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, ctx->d1->cfg, ctx->d2->cfg, ctx->d1, ctx->d2, | 1420 | ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, 0, ctx->d1->cfg, ctx->d2->cfg, ctx->d1, ctx->d2, |
1416 | _("Failed to connect to core service of first peer!\n")); | 1421 | _("Failed to connect to core service of first peer!\n")); |
1417 | GNUNET_free (ctx); | 1422 | GNUNET_free (ctx); |
1418 | return; | 1423 | return; |
@@ -1425,7 +1430,7 @@ reattempt_daemons_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext | |||
1425 | GNUNET_CORE_disconnect(ctx->d1core); | 1430 | GNUNET_CORE_disconnect(ctx->d1core); |
1426 | GNUNET_free (ctx); | 1431 | GNUNET_free (ctx); |
1427 | if (NULL != ctx->cb) | 1432 | if (NULL != ctx->cb) |
1428 | ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, ctx->d1->cfg, ctx->d2->cfg, ctx->d1, ctx->d2, | 1433 | ctx->cb (ctx->cb_cls, &ctx->d1->id, &ctx->d2->id, 0, ctx->d1->cfg, ctx->d2->cfg, ctx->d1, ctx->d2, |
1429 | _("Failed to connect to transport service!\n")); | 1434 | _("Failed to connect to transport service!\n")); |
1430 | return; | 1435 | return; |
1431 | } | 1436 | } |
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 9965bb2fb..b6ae14036 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -22,6 +22,15 @@ | |||
22 | * @file testing/testing_group.c | 22 | * @file testing/testing_group.c |
23 | * @brief convenience API for writing testcases for GNUnet | 23 | * @brief convenience API for writing testcases for GNUnet |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * | ||
26 | * FIXME: have connection processor functions take a cls argument | ||
27 | * which specifies where to write the connection information | ||
28 | * instead of assuming it's certain peergroup places. (maybe?) | ||
29 | * FIXME: create static struct which contains the TOPOLOGY enum, the | ||
30 | * associated string, and the function used to create it. | ||
31 | * Then replace the create_X calls with topology_struct[i][2] | ||
32 | * or something. (Store function pointers instead of using | ||
33 | * switch statements) | ||
25 | */ | 34 | */ |
26 | #include "platform.h" | 35 | #include "platform.h" |
27 | #include "gnunet_arm_service.h" | 36 | #include "gnunet_arm_service.h" |
@@ -108,6 +117,11 @@ static char * GNUNET_TESTING_TopologyStrings[] = | |||
108 | "SCALE_FREE", | 117 | "SCALE_FREE", |
109 | 118 | ||
110 | /** | 119 | /** |
120 | * Straight line topology. | ||
121 | */ | ||
122 | "LINE", | ||
123 | |||
124 | /** | ||
111 | * All peers are disconnected. | 125 | * All peers are disconnected. |
112 | */ | 126 | */ |
113 | "NONE" | 127 | "NONE" |
@@ -902,6 +916,17 @@ create_scale_free (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Connectio | |||
902 | return total_connections; | 916 | return total_connections; |
903 | } | 917 | } |
904 | 918 | ||
919 | /** | ||
920 | * Create a topology given a peer group (set of running peers) | ||
921 | * and a connection processor. | ||
922 | * | ||
923 | * @param pg the peergroup to create the topology on | ||
924 | * @param proc the connection processor to call to actually set | ||
925 | * up connections between two peers | ||
926 | * | ||
927 | * @return the number of connections that were set up | ||
928 | * | ||
929 | */ | ||
905 | int | 930 | int |
906 | create_small_world_ring(struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) | 931 | create_small_world_ring(struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) |
907 | { | 932 | { |
@@ -1013,7 +1038,17 @@ create_small_world_ring(struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Conn | |||
1013 | return connect_attempts; | 1038 | return connect_attempts; |
1014 | } | 1039 | } |
1015 | 1040 | ||
1016 | 1041 | /** | |
1042 | * Create a topology given a peer group (set of running peers) | ||
1043 | * and a connection processor. | ||
1044 | * | ||
1045 | * @param pg the peergroup to create the topology on | ||
1046 | * @param proc the connection processor to call to actually set | ||
1047 | * up connections between two peers | ||
1048 | * | ||
1049 | * @return the number of connections that were set up | ||
1050 | * | ||
1051 | */ | ||
1017 | static int | 1052 | static int |
1018 | create_nated_internet (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) | 1053 | create_nated_internet (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) |
1019 | { | 1054 | { |
@@ -1065,8 +1100,17 @@ create_nated_internet (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Conne | |||
1065 | 1100 | ||
1066 | } | 1101 | } |
1067 | 1102 | ||
1068 | 1103 | /** | |
1069 | 1104 | * Create a topology given a peer group (set of running peers) | |
1105 | * and a connection processor. | ||
1106 | * | ||
1107 | * @param pg the peergroup to create the topology on | ||
1108 | * @param proc the connection processor to call to actually set | ||
1109 | * up connections between two peers | ||
1110 | * | ||
1111 | * @return the number of connections that were set up | ||
1112 | * | ||
1113 | */ | ||
1070 | static int | 1114 | static int |
1071 | create_small_world (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) | 1115 | create_small_world (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) |
1072 | { | 1116 | { |
@@ -1208,8 +1252,17 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Connecti | |||
1208 | return connect_attempts; | 1252 | return connect_attempts; |
1209 | } | 1253 | } |
1210 | 1254 | ||
1211 | 1255 | /** | |
1212 | 1256 | * Create a topology given a peer group (set of running peers) | |
1257 | * and a connection processor. | ||
1258 | * | ||
1259 | * @param pg the peergroup to create the topology on | ||
1260 | * @param proc the connection processor to call to actually set | ||
1261 | * up connections between two peers | ||
1262 | * | ||
1263 | * @return the number of connections that were set up | ||
1264 | * | ||
1265 | */ | ||
1213 | static int | 1266 | static int |
1214 | create_erdos_renyi (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) | 1267 | create_erdos_renyi (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) |
1215 | { | 1268 | { |
@@ -1257,6 +1310,17 @@ create_erdos_renyi (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_Connecti | |||
1257 | return connect_attempts; | 1310 | return connect_attempts; |
1258 | } | 1311 | } |
1259 | 1312 | ||
1313 | /** | ||
1314 | * Create a topology given a peer group (set of running peers) | ||
1315 | * and a connection processor. | ||
1316 | * | ||
1317 | * @param pg the peergroup to create the topology on | ||
1318 | * @param proc the connection processor to call to actually set | ||
1319 | * up connections between two peers | ||
1320 | * | ||
1321 | * @return the number of connections that were set up | ||
1322 | * | ||
1323 | */ | ||
1260 | static int | 1324 | static int |
1261 | create_2d_torus (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) | 1325 | create_2d_torus (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) |
1262 | { | 1326 | { |
@@ -1334,7 +1398,17 @@ create_2d_torus (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionP | |||
1334 | } | 1398 | } |
1335 | 1399 | ||
1336 | 1400 | ||
1337 | 1401 | /** | |
1402 | * Create a topology given a peer group (set of running peers) | ||
1403 | * and a connection processor. | ||
1404 | * | ||
1405 | * @param pg the peergroup to create the topology on | ||
1406 | * @param proc the connection processor to call to actually set | ||
1407 | * up connections between two peers | ||
1408 | * | ||
1409 | * @return the number of connections that were set up | ||
1410 | * | ||
1411 | */ | ||
1338 | static int | 1412 | static int |
1339 | create_clique (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) | 1413 | create_clique (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) |
1340 | { | 1414 | { |
@@ -1361,7 +1435,50 @@ create_clique (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionPro | |||
1361 | return connect_attempts; | 1435 | return connect_attempts; |
1362 | } | 1436 | } |
1363 | 1437 | ||
1438 | /** | ||
1439 | * Create a topology given a peer group (set of running peers) | ||
1440 | * and a connection processor. | ||
1441 | * | ||
1442 | * @param pg the peergroup to create the topology on | ||
1443 | * @param proc the connection processor to call to actually set | ||
1444 | * up connections between two peers | ||
1445 | * | ||
1446 | * @return the number of connections that were set up | ||
1447 | * | ||
1448 | */ | ||
1449 | static int | ||
1450 | create_line (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) | ||
1451 | { | ||
1452 | unsigned int count; | ||
1453 | int connect_attempts; | ||
1454 | |||
1455 | connect_attempts = 0; | ||
1456 | |||
1457 | /* Connect each peer to the next highest numbered peer */ | ||
1458 | for (count = 0; count < pg->total - 1; count++) | ||
1459 | { | ||
1460 | #if VERBOSE_TESTING | ||
1461 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1462 | "Connecting peer %d to peer %d\n", | ||
1463 | count, count + 1); | ||
1464 | #endif | ||
1465 | connect_attempts += proc(pg, count, count + 1); | ||
1466 | } | ||
1364 | 1467 | ||
1468 | return connect_attempts; | ||
1469 | } | ||
1470 | |||
1471 | /** | ||
1472 | * Create a topology given a peer group (set of running peers) | ||
1473 | * and a connection processor. | ||
1474 | * | ||
1475 | * @param pg the peergroup to create the topology on | ||
1476 | * @param proc the connection processor to call to actually set | ||
1477 | * up connections between two peers | ||
1478 | * | ||
1479 | * @return the number of connections that were set up | ||
1480 | * | ||
1481 | */ | ||
1365 | static int | 1482 | static int |
1366 | create_ring (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) | 1483 | create_ring (struct GNUNET_TESTING_PeerGroup *pg, GNUNET_TESTING_ConnectionProcessor proc) |
1367 | { | 1484 | { |
@@ -1745,6 +1862,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, char *tran | |||
1745 | static void internal_connect_notify (void *cls, | 1862 | static void internal_connect_notify (void *cls, |
1746 | const struct GNUNET_PeerIdentity *first, | 1863 | const struct GNUNET_PeerIdentity *first, |
1747 | const struct GNUNET_PeerIdentity *second, | 1864 | const struct GNUNET_PeerIdentity *second, |
1865 | uint32_t distance, | ||
1748 | const struct GNUNET_CONFIGURATION_Handle *first_cfg, | 1866 | const struct GNUNET_CONFIGURATION_Handle *first_cfg, |
1749 | const struct GNUNET_CONFIGURATION_Handle *second_cfg, | 1867 | const struct GNUNET_CONFIGURATION_Handle *second_cfg, |
1750 | struct GNUNET_TESTING_Daemon *first_daemon, | 1868 | struct GNUNET_TESTING_Daemon *first_daemon, |
@@ -1754,12 +1872,16 @@ static void internal_connect_notify (void *cls, | |||
1754 | struct GNUNET_TESTING_PeerGroup *pg = cls; | 1872 | struct GNUNET_TESTING_PeerGroup *pg = cls; |
1755 | outstanding_connects--; | 1873 | outstanding_connects--; |
1756 | 1874 | ||
1875 | <<<<<<< .mine | ||
1876 | pg->notify_connection(pg->notify_connection_cls, first, second, distance, first_cfg, second_cfg, first_daemon, second_daemon, emsg); | ||
1877 | ======= | ||
1757 | pg->notify_connection(pg->notify_connection_cls, | 1878 | pg->notify_connection(pg->notify_connection_cls, |
1758 | first, | 1879 | first, |
1759 | second, | 1880 | second, |
1760 | first_cfg, second_cfg, | 1881 | first_cfg, second_cfg, |
1761 | first_daemon, second_daemon, | 1882 | first_daemon, second_daemon, |
1762 | emsg); | 1883 | emsg); |
1884 | >>>>>>> .r11782 | ||
1763 | 1885 | ||
1764 | } | 1886 | } |
1765 | 1887 | ||
@@ -2010,6 +2132,13 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg, | |||
2010 | #endif | 2132 | #endif |
2011 | num_connections = create_scale_free (pg, &add_allowed_connections); | 2133 | num_connections = create_scale_free (pg, &add_allowed_connections); |
2012 | break; | 2134 | break; |
2135 | case GNUNET_TESTING_TOPOLOGY_LINE: | ||
2136 | #if VERBOSE_TESTING | ||
2137 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2138 | _("Creating straight line topology\n")); | ||
2139 | #endif | ||
2140 | num_connections = create_line (pg, &add_allowed_connections); | ||
2141 | break; | ||
2013 | case GNUNET_TESTING_TOPOLOGY_NONE: | 2142 | case GNUNET_TESTING_TOPOLOGY_NONE: |
2014 | num_connections = 0; | 2143 | num_connections = 0; |
2015 | break; | 2144 | break; |
@@ -2103,6 +2232,13 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg, | |||
2103 | #endif | 2232 | #endif |
2104 | unblacklisted_connections = create_scale_free (pg, &unblacklist_connections); | 2233 | unblacklisted_connections = create_scale_free (pg, &unblacklist_connections); |
2105 | break; | 2234 | break; |
2235 | case GNUNET_TESTING_TOPOLOGY_LINE: | ||
2236 | #if VERBOSE_TESTING | ||
2237 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2238 | _("Blacklisting all but straight line topology\n")); | ||
2239 | #endif | ||
2240 | unblacklisted_connections = create_line (pg, &unblacklist_connections); | ||
2241 | break; | ||
2106 | case GNUNET_TESTING_TOPOLOGY_NONE: | 2242 | case GNUNET_TESTING_TOPOLOGY_NONE: |
2107 | /* Fall through */ | 2243 | /* Fall through */ |
2108 | default: | 2244 | default: |
@@ -2581,6 +2717,13 @@ GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg, | |||
2581 | #endif | 2717 | #endif |
2582 | create_scale_free (pg, &add_actual_connections); | 2718 | create_scale_free (pg, &add_actual_connections); |
2583 | break; | 2719 | break; |
2720 | case GNUNET_TESTING_TOPOLOGY_LINE: | ||
2721 | #if VERBOSE_TOPOLOGY | ||
2722 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2723 | _("Creating straight line CONNECT topology\n")); | ||
2724 | #endif | ||
2725 | create_line (pg, &add_actual_connections); | ||
2726 | break; | ||
2584 | case GNUNET_TESTING_TOPOLOGY_NONE: | 2727 | case GNUNET_TESTING_TOPOLOGY_NONE: |
2585 | #if VERBOSE_TOPOLOGY | 2728 | #if VERBOSE_TOPOLOGY |
2586 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2729 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |