diff options
-rw-r--r-- | src/include/gnunet_testing_ng_lib.h | 14 | ||||
-rw-r--r-- | src/testing/testing.c | 6 | ||||
-rw-r--r-- | src/testing/testing_api_loop.c | 22 | ||||
-rw-r--r-- | src/transport/gnunet-communicator-tcp.c | 25 | ||||
-rw-r--r-- | src/transport/gnunet-service-tng.c | 67 | ||||
-rw-r--r-- | src/transport/test_transport_plugin_cmd_simple_send.c | 3 | ||||
-rw-r--r-- | src/transport/test_transport_plugin_cmd_simple_send_broadcast.c | 2 | ||||
-rw-r--r-- | src/transport/test_transport_plugin_cmd_udp_backchannel.c | 3 | ||||
-rw-r--r-- | src/transport/transport-testing-cmds.h | 41 | ||||
-rw-r--r-- | src/transport/transport_api_cmd_connecting_peers.c | 55 |
10 files changed, 195 insertions, 43 deletions
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h index 5011aefd8..c9f5e3e00 100644 --- a/src/include/gnunet_testing_ng_lib.h +++ b/src/include/gnunet_testing_ng_lib.h | |||
@@ -231,6 +231,20 @@ GNUNET_TESTING_interpreter_lookup_command ( | |||
231 | 231 | ||
232 | 232 | ||
233 | /** | 233 | /** |
234 | * Lookup command by label. | ||
235 | * All commands, first into the past, then into the furture are looked up. | ||
236 | * | ||
237 | * @param is interpreter to lookup command in | ||
238 | * @param label label of the command to lookup. | ||
239 | * @return the command, if it is found, or NULL. | ||
240 | */ | ||
241 | const struct GNUNET_TESTING_Command * | ||
242 | GNUNET_TESTING_interpreter_lookup_command_all ( | ||
243 | struct GNUNET_TESTING_Interpreter *is, | ||
244 | const char *label); | ||
245 | |||
246 | |||
247 | /** | ||
234 | * Obtain label of the command being now run. | 248 | * Obtain label of the command being now run. |
235 | * | 249 | * |
236 | * @param is interpreter state. | 250 | * @param is interpreter state. |
diff --git a/src/testing/testing.c b/src/testing/testing.c index 9e664292b..7474d9b5f 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -2312,10 +2312,14 @@ GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection, | |||
2312 | { | 2312 | { |
2313 | template = KNOWN_CONNECT_ADDRESS_TEMPLATE; | 2313 | template = KNOWN_CONNECT_ADDRESS_TEMPLATE; |
2314 | } | 2314 | } |
2315 | else | 2315 | else if (1 == connection->node_n) |
2316 | { | 2316 | { |
2317 | template = ROUTER_CONNECT_ADDRESS_TEMPLATE; | 2317 | template = ROUTER_CONNECT_ADDRESS_TEMPLATE; |
2318 | } | 2318 | } |
2319 | else | ||
2320 | { | ||
2321 | return NULL; | ||
2322 | } | ||
2319 | 2323 | ||
2320 | if (0 == strcmp (PREFIX_TCP, prefix)) | 2324 | if (0 == strcmp (PREFIX_TCP, prefix)) |
2321 | { | 2325 | { |
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c index e82ec33ab..290311c59 100644 --- a/src/testing/testing_api_loop.c +++ b/src/testing/testing_api_loop.c | |||
@@ -192,6 +192,28 @@ GNUNET_TESTING_interpreter_lookup_command ( | |||
192 | 192 | ||
193 | 193 | ||
194 | /** | 194 | /** |
195 | * Lookup command by label. | ||
196 | * All commands, first into the past, then into the furture are looked up. | ||
197 | * | ||
198 | * @param is interpreter to lookup command in | ||
199 | * @param label label of the command to lookup. | ||
200 | * @return the command, if it is found, or NULL. | ||
201 | */ | ||
202 | const struct GNUNET_TESTING_Command * | ||
203 | GNUNET_TESTING_interpreter_lookup_command_all ( | ||
204 | struct GNUNET_TESTING_Interpreter *is, | ||
205 | const char *label) | ||
206 | { | ||
207 | const struct GNUNET_TESTING_Command *cmd; | ||
208 | |||
209 | cmd = get_command (is, label, GNUNET_NO); | ||
210 | if (NULL == cmd) | ||
211 | cmd = get_command (is, label, GNUNET_YES); | ||
212 | return cmd; | ||
213 | } | ||
214 | |||
215 | |||
216 | /** | ||
195 | * Finish the test run, return the final result. | 217 | * Finish the test run, return the final result. |
196 | * | 218 | * |
197 | * @param cls the `struct GNUNET_TESTING_Interpreter` | 219 | * @param cls the `struct GNUNET_TESTING_Interpreter` |
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index 6f7e67d7b..2a5e33e2b 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c | |||
@@ -2556,11 +2556,17 @@ handshake_monotime_cb (void *cls, | |||
2556 | 2556 | ||
2557 | handshake_monotonic_time = &queue->handshake_monotonic_time; | 2557 | handshake_monotonic_time = &queue->handshake_monotonic_time; |
2558 | pid = &queue->target; | 2558 | pid = &queue->target; |
2559 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2560 | "tcp handshake with us %s\n", | ||
2561 | GNUNET_i2s (&my_identity)); | ||
2559 | if (NULL == record) | 2562 | if (NULL == record) |
2560 | { | 2563 | { |
2561 | queue->handshake_monotime_get = NULL; | 2564 | queue->handshake_monotime_get = NULL; |
2562 | return; | 2565 | return; |
2563 | } | 2566 | } |
2567 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2568 | "tcp handshake from peer %s\n", | ||
2569 | GNUNET_i2s (pid)); | ||
2564 | if (sizeof(*mtbe) != record->value_size) | 2570 | if (sizeof(*mtbe) != record->value_size) |
2565 | { | 2571 | { |
2566 | GNUNET_break (0); | 2572 | GNUNET_break (0); |
@@ -2610,6 +2616,7 @@ decrypt_and_check_tc (struct Queue *queue, | |||
2610 | char *ibuf) | 2616 | char *ibuf) |
2611 | { | 2617 | { |
2612 | struct TcpHandshakeSignature ths; | 2618 | struct TcpHandshakeSignature ths; |
2619 | enum GNUNET_GenericReturnValue ret; | ||
2613 | 2620 | ||
2614 | GNUNET_assert ( | 2621 | GNUNET_assert ( |
2615 | 0 == | 2622 | 0 == |
@@ -2625,18 +2632,20 @@ decrypt_and_check_tc (struct Queue *queue, | |||
2625 | memcpy (&ths.ephemeral, ibuf, sizeof(struct GNUNET_CRYPTO_EcdhePublicKey)); | 2632 | memcpy (&ths.ephemeral, ibuf, sizeof(struct GNUNET_CRYPTO_EcdhePublicKey)); |
2626 | ths.monotonic_time = tc->monotonic_time; | 2633 | ths.monotonic_time = tc->monotonic_time; |
2627 | ths.challenge = tc->challenge; | 2634 | ths.challenge = tc->challenge; |
2628 | queue->handshake_monotime_get = | 2635 | ret = GNUNET_CRYPTO_eddsa_verify ( |
2629 | GNUNET_PEERSTORE_iterate (peerstore, | ||
2630 | "transport_tcp_communicator", | ||
2631 | &queue->target, | ||
2632 | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE, | ||
2633 | &handshake_monotime_cb, | ||
2634 | queue); | ||
2635 | return GNUNET_CRYPTO_eddsa_verify ( | ||
2636 | GNUNET_SIGNATURE_COMMUNICATOR_TCP_HANDSHAKE, | 2636 | GNUNET_SIGNATURE_COMMUNICATOR_TCP_HANDSHAKE, |
2637 | &ths, | 2637 | &ths, |
2638 | &tc->sender_sig, | 2638 | &tc->sender_sig, |
2639 | &tc->sender.public_key); | 2639 | &tc->sender.public_key); |
2640 | if (GNUNET_YES == ret) | ||
2641 | queue->handshake_monotime_get = | ||
2642 | GNUNET_PEERSTORE_iterate (peerstore, | ||
2643 | "transport_tcp_communicator", | ||
2644 | &queue->target, | ||
2645 | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE, | ||
2646 | &handshake_monotime_cb, | ||
2647 | queue); | ||
2648 | return ret; | ||
2640 | } | 2649 | } |
2641 | 2650 | ||
2642 | 2651 | ||
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c index 4483536f0..f67bc0db5 100644 --- a/src/transport/gnunet-service-tng.c +++ b/src/transport/gnunet-service-tng.c | |||
@@ -5381,7 +5381,7 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh) | |||
5381 | int have_core; | 5381 | int have_core; |
5382 | 5382 | ||
5383 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 5383 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
5384 | "Handling message of type %u with %u bytes\n", | 5384 | "Handling raw message of type %u with %u bytes\n", |
5385 | (unsigned int) ntohs (mh->type), | 5385 | (unsigned int) ntohs (mh->type), |
5386 | (unsigned int) ntohs (mh->size)); | 5386 | (unsigned int) ntohs (mh->size)); |
5387 | 5387 | ||
@@ -6633,11 +6633,10 @@ forward_dv_learn (const struct GNUNET_PeerIdentity *next_hop, | |||
6633 | struct DvHopPS dhp = { | 6633 | struct DvHopPS dhp = { |
6634 | .purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DV_HOP), | 6634 | .purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DV_HOP), |
6635 | .purpose.size = htonl (sizeof(dhp)), | 6635 | .purpose.size = htonl (sizeof(dhp)), |
6636 | .pred = dhops[nhops - 1].hop, | 6636 | .pred = (0 == nhops) ? msg->initiator : dhops[nhops - 1].hop, |
6637 | .succ = *next_hop, | 6637 | .succ = *next_hop, |
6638 | .challenge = msg->challenge | 6638 | .challenge = msg->challenge |
6639 | }; | 6639 | }; |
6640 | |||
6641 | GNUNET_CRYPTO_eddsa_sign (GST_my_private_key, | 6640 | GNUNET_CRYPTO_eddsa_sign (GST_my_private_key, |
6642 | &dhp, | 6641 | &dhp, |
6643 | &dhops[nhops].hop_sig); | 6642 | &dhops[nhops].hop_sig); |
@@ -6940,7 +6939,14 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl) | |||
6940 | struct GNUNET_TIME_Absolute in_time; | 6939 | struct GNUNET_TIME_Absolute in_time; |
6941 | struct Neighbour *n; | 6940 | struct Neighbour *n; |
6942 | 6941 | ||
6943 | nhops = ntohs (dvl->bidirectional); /* 0 = sender is initiator */ | 6942 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
6943 | "handle dv learn message from %s\n", | ||
6944 | GNUNET_i2s (&dvl->initiator)); | ||
6945 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
6946 | "handle dv learn message sender %s\n", | ||
6947 | GNUNET_i2s (&cmc->im.sender)); | ||
6948 | |||
6949 | nhops = ntohs (dvl->num_hops); /* 0 = sender is initiator */ | ||
6944 | bi_history = ntohs (dvl->bidirectional); | 6950 | bi_history = ntohs (dvl->bidirectional); |
6945 | hops = (const struct DVPathEntryP *) &dvl[1]; | 6951 | hops = (const struct DVPathEntryP *) &dvl[1]; |
6946 | if (0 == nhops) | 6952 | if (0 == nhops) |
@@ -6955,6 +6961,9 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl) | |||
6955 | } | 6961 | } |
6956 | else | 6962 | else |
6957 | { | 6963 | { |
6964 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
6965 | "handle dv learn message last hop %s\n", | ||
6966 | GNUNET_i2s (&hops[nhops - 1].hop)); | ||
6958 | /* sanity check */ | 6967 | /* sanity check */ |
6959 | if (0 != GNUNET_memcmp (&hops[nhops - 1].hop, &cmc->im.sender)) | 6968 | if (0 != GNUNET_memcmp (&hops[nhops - 1].hop, &cmc->im.sender)) |
6960 | { | 6969 | { |
@@ -6970,6 +6979,10 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl) | |||
6970 | cc); // FIXME: add bi-directional flag to cc? | 6979 | cc); // FIXME: add bi-directional flag to cc? |
6971 | in_time = GNUNET_TIME_absolute_get (); | 6980 | in_time = GNUNET_TIME_absolute_get (); |
6972 | 6981 | ||
6982 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
6983 | "2 handle dv learn message from %s\n", | ||
6984 | GNUNET_i2s (&dvl->initiator)); | ||
6985 | |||
6973 | /* continue communicator here, everything else can happen asynchronous! */ | 6986 | /* continue communicator here, everything else can happen asynchronous! */ |
6974 | finish_cmc_handling (cmc); | 6987 | finish_cmc_handling (cmc); |
6975 | 6988 | ||
@@ -6980,6 +6993,9 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl) | |||
6980 | (GNUNET_TIME_absolute_ntoh (dvl->monotonic_time).abs_value_us < | 6993 | (GNUNET_TIME_absolute_ntoh (dvl->monotonic_time).abs_value_us < |
6981 | n->last_dv_learn_monotime.abs_value_us)) | 6994 | n->last_dv_learn_monotime.abs_value_us)) |
6982 | { | 6995 | { |
6996 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
6997 | "DV learn from %s discarded due to time travel", | ||
6998 | GNUNET_i2s (&dvl->initiator)); | ||
6983 | GNUNET_STATISTICS_update (GST_stats, | 6999 | GNUNET_STATISTICS_update (GST_stats, |
6984 | "# DV learn discarded due to time travel", | 7000 | "# DV learn discarded due to time travel", |
6985 | 1, | 7001 | 1, |
@@ -6991,6 +7007,9 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl) | |||
6991 | &dvl->challenge, | 7007 | &dvl->challenge, |
6992 | &dvl->init_sig)) | 7008 | &dvl->init_sig)) |
6993 | { | 7009 | { |
7010 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
7011 | "DV learn signature from %s invalid", | ||
7012 | GNUNET_i2s (&dvl->initiator)); | ||
6994 | GNUNET_break_op (0); | 7013 | GNUNET_break_op (0); |
6995 | return; | 7014 | return; |
6996 | } | 7015 | } |
@@ -7012,6 +7031,9 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl) | |||
7012 | n); | 7031 | n); |
7013 | } | 7032 | } |
7014 | } | 7033 | } |
7034 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
7035 | "3 handle dv learn message from %s\n", | ||
7036 | GNUNET_i2s (&dvl->initiator)); | ||
7015 | /* OPTIMIZE-FIXME: asynchronously (!) verify signatures!, | 7037 | /* OPTIMIZE-FIXME: asynchronously (!) verify signatures!, |
7016 | If signature verification load too high, implement random drop strategy */ | 7038 | If signature verification load too high, implement random drop strategy */ |
7017 | for (unsigned int i = 0; i < nhops; i++) | 7039 | for (unsigned int i = 0; i < nhops; i++) |
@@ -7030,11 +7052,29 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl) | |||
7030 | &hops[i].hop_sig, | 7052 | &hops[i].hop_sig, |
7031 | &hops[i].hop.public_key)) | 7053 | &hops[i].hop.public_key)) |
7032 | { | 7054 | { |
7055 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
7056 | "DV learn from %s signature of hop %u invalid\n", | ||
7057 | GNUNET_i2s (&dvl->initiator), | ||
7058 | i); | ||
7059 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
7060 | "signature of hop %s invalid\n", | ||
7061 | GNUNET_i2s (&hops[i].hop)); | ||
7062 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
7063 | "pred %s\n", | ||
7064 | GNUNET_i2s (&dhp.pred)); | ||
7065 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
7066 | "succ %s\n", | ||
7067 | GNUNET_i2s (&dhp.succ)); | ||
7068 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
7069 | "hash %s\n", | ||
7070 | GNUNET_sh2s (&dhp.challenge.value)); | ||
7033 | GNUNET_break_op (0); | 7071 | GNUNET_break_op (0); |
7034 | return; | 7072 | return; |
7035 | } | 7073 | } |
7036 | } | 7074 | } |
7037 | 7075 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |
7076 | "4 handle dv learn message from %s\n", | ||
7077 | GNUNET_i2s (&dvl->initiator)); | ||
7038 | if (GNUNET_EXTRA_LOGGING > 0) | 7078 | if (GNUNET_EXTRA_LOGGING > 0) |
7039 | { | 7079 | { |
7040 | char *path; | 7080 | char *path; |
@@ -7059,7 +7099,9 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl) | |||
7059 | GNUNET_i2s (&GST_my_identity)); | 7099 | GNUNET_i2s (&GST_my_identity)); |
7060 | GNUNET_free (path); | 7100 | GNUNET_free (path); |
7061 | } | 7101 | } |
7062 | 7102 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |
7103 | "5 handle dv learn message from %s\n", | ||
7104 | GNUNET_i2s (&dvl->initiator)); | ||
7063 | do_fwd = GNUNET_YES; | 7105 | do_fwd = GNUNET_YES; |
7064 | if (0 == GNUNET_memcmp (&GST_my_identity, &dvl->initiator)) | 7106 | if (0 == GNUNET_memcmp (&GST_my_identity, &dvl->initiator)) |
7065 | { | 7107 | { |
@@ -7104,6 +7146,9 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl) | |||
7104 | do_fwd = GNUNET_NO; | 7146 | do_fwd = GNUNET_NO; |
7105 | return; | 7147 | return; |
7106 | } | 7148 | } |
7149 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
7150 | "6 handle dv learn message from %s\n", | ||
7151 | GNUNET_i2s (&dvl->initiator)); | ||
7107 | if (bi_hop) | 7152 | if (bi_hop) |
7108 | { | 7153 | { |
7109 | /* last hop was bi-directional, we could learn something here! */ | 7154 | /* last hop was bi-directional, we could learn something here! */ |
@@ -7160,13 +7205,18 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl) | |||
7160 | } | 7205 | } |
7161 | } | 7206 | } |
7162 | } | 7207 | } |
7163 | 7208 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |
7209 | "7 handle dv learn message from %s\n", | ||
7210 | GNUNET_i2s (&dvl->initiator)); | ||
7164 | if (MAX_DV_HOPS_ALLOWED == nhops) | 7211 | if (MAX_DV_HOPS_ALLOWED == nhops) |
7165 | { | 7212 | { |
7166 | /* At limit, we're out of here! */ | 7213 | /* At limit, we're out of here! */ |
7167 | return; | 7214 | return; |
7168 | } | 7215 | } |
7169 | 7216 | ||
7217 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
7218 | "8 handle dv learn message from %s\n", | ||
7219 | GNUNET_i2s (&dvl->initiator)); | ||
7170 | /* Forward to initiator, if path non-trivial and possible */ | 7220 | /* Forward to initiator, if path non-trivial and possible */ |
7171 | bi_history = (bi_history << 1) | (bi_hop ? 1 : 0); | 7221 | bi_history = (bi_history << 1) | (bi_hop ? 1 : 0); |
7172 | did_initiator = GNUNET_NO; | 7222 | did_initiator = GNUNET_NO; |
@@ -7220,6 +7270,9 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl) | |||
7220 | &dv_neighbour_transmission, | 7270 | &dv_neighbour_transmission, |
7221 | &nsc); | 7271 | &nsc); |
7222 | } | 7272 | } |
7273 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
7274 | "9 handle dv learn message from %s\n", | ||
7275 | GNUNET_i2s (&dvl->initiator)); | ||
7223 | } | 7276 | } |
7224 | 7277 | ||
7225 | 7278 | ||
diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c b/src/transport/test_transport_plugin_cmd_simple_send.c index 476fbdf4f..6a6861d77 100644 --- a/src/transport/test_transport_plugin_cmd_simple_send.c +++ b/src/transport/test_transport_plugin_cmd_simple_send.c | |||
@@ -255,7 +255,8 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, | |||
255 | "start-peer", | 255 | "start-peer", |
256 | "system-create", | 256 | "system-create", |
257 | num, | 257 | num, |
258 | topology); | 258 | topology, |
259 | 0); | ||
259 | local_prepared = GNUNET_TESTING_cmd_local_test_prepared ( | 260 | local_prepared = GNUNET_TESTING_cmd_local_test_prepared ( |
260 | "local-test-prepared", | 261 | "local-test-prepared", |
261 | write_message); | 262 | write_message); |
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c b/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c index e2757671b..526f08e6a 100644 --- a/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c +++ b/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c | |||
@@ -117,6 +117,8 @@ all_peers_started () | |||
117 | { | 117 | { |
118 | struct GNUNET_TESTING_AsyncContext *ac; | 118 | struct GNUNET_TESTING_AsyncContext *ac; |
119 | 119 | ||
120 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
121 | "Received message\n"); | ||
120 | GNUNET_TESTING_get_trait_async_context (&block_send, | 122 | GNUNET_TESTING_get_trait_async_context (&block_send, |
121 | &ac); | 123 | &ac); |
122 | GNUNET_assert (NULL != ac); | 124 | GNUNET_assert (NULL != ac); |
diff --git a/src/transport/test_transport_plugin_cmd_udp_backchannel.c b/src/transport/test_transport_plugin_cmd_udp_backchannel.c index c98a3075d..b594049c9 100644 --- a/src/transport/test_transport_plugin_cmd_udp_backchannel.c +++ b/src/transport/test_transport_plugin_cmd_udp_backchannel.c | |||
@@ -242,7 +242,8 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, | |||
242 | "start-peer", | 242 | "start-peer", |
243 | "system-create", | 243 | "system-create", |
244 | num, | 244 | num, |
245 | topology); | 245 | topology, |
246 | 0); | ||
246 | local_prepared = GNUNET_TESTING_cmd_local_test_prepared ( | 247 | local_prepared = GNUNET_TESTING_cmd_local_test_prepared ( |
247 | "local-test-prepared", | 248 | "local-test-prepared", |
248 | write_message); | 249 | write_message); |
diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h index d2e49c0d3..d64279aeb 100644 --- a/src/transport/transport-testing-cmds.h +++ b/src/transport/transport-testing-cmds.h | |||
@@ -82,6 +82,21 @@ struct ConnectPeersState | |||
82 | * Number of connections. | 82 | * Number of connections. |
83 | */ | 83 | */ |
84 | unsigned int con_num; | 84 | unsigned int con_num; |
85 | |||
86 | /** | ||
87 | * Number of additional connects this cmd will wait for not triggered by this cmd. | ||
88 | */ | ||
89 | unsigned int additional_connects; | ||
90 | |||
91 | /** | ||
92 | * Number of connections we already have a notification for. | ||
93 | */ | ||
94 | unsigned int con_num_notified; | ||
95 | |||
96 | /** | ||
97 | * Number of additional connects this cmd will wait for not triggered by this cmd we already have a notification for. | ||
98 | */ | ||
99 | unsigned int additional_connects_notified; | ||
85 | }; | 100 | }; |
86 | 101 | ||
87 | struct StartPeerState | 102 | struct StartPeerState |
@@ -227,13 +242,25 @@ GNUNET_TRANSPORT_cmd_stop_peer (const char *label, | |||
227 | const char *start_label); | 242 | const char *start_label); |
228 | 243 | ||
229 | 244 | ||
245 | /** | ||
246 | * Create command | ||
247 | * | ||
248 | * @param label name for command | ||
249 | * @param start_peer_label Label of the cmd to start a peer. | ||
250 | * @param create_peer_label Label of the cmd which started the test system. | ||
251 | * @param num Number globally identifying the node. | ||
252 | * @param The topology for the test setup. | ||
253 | * @param additional_connects Number of additional connects this cmd will wait for not triggered by this cmd. | ||
254 | * @return command. | ||
255 | */ | ||
230 | struct GNUNET_TESTING_Command | 256 | struct GNUNET_TESTING_Command |
231 | GNUNET_TRANSPORT_cmd_connect_peers (const char *label, | 257 | GNUNET_TRANSPORT_cmd_connect_peers ( |
232 | const char *start_peer_label, | 258 | const char *label, |
233 | const char *create_label, | 259 | const char *start_peer_label, |
234 | uint32_t num, | 260 | const char *create_label, |
235 | struct GNUNET_TESTING_NetjailTopology * | 261 | uint32_t num, |
236 | topology); | 262 | struct GNUNET_TESTING_NetjailTopology *topology, |
263 | unsigned int additional_connects); | ||
237 | 264 | ||
238 | 265 | ||
239 | /** | 266 | /** |
@@ -241,7 +268,7 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label, | |||
241 | * | 268 | * |
242 | * @param label name for command. | 269 | * @param label name for command. |
243 | * @param start_peer_label Label of the cmd to start a peer. | 270 | * @param start_peer_label Label of the cmd to start a peer. |
244 | * @param start_peer_label Label of the cmd which started the test system. | 271 | * @param create_peer_label Label of the cmd which started the test system. |
245 | * @param num Number globally identifying the node. | 272 | * @param num Number globally identifying the node. |
246 | * @param The topology for the test setup. | 273 | * @param The topology for the test setup. |
247 | * @return command. | 274 | * @return command. |
diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c index 3fef7d687..33faee296 100644 --- a/src/transport/transport_api_cmd_connecting_peers.c +++ b/src/transport/transport_api_cmd_connecting_peers.c | |||
@@ -91,17 +91,20 @@ connect_peers_run (void *cls, | |||
91 | { | 91 | { |
92 | addr = GNUNET_TESTING_get_address (pos_connection, | 92 | addr = GNUNET_TESTING_get_address (pos_connection, |
93 | pos_prefix->address_prefix); | 93 | pos_prefix->address_prefix); |
94 | peer = GNUNET_TESTING_get_pub_key (num, tl_system); | 94 | if (NULL != addr) |
95 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 95 | { |
96 | "validating peer number %u with identity %s\n", | 96 | peer = GNUNET_TESTING_get_pub_key (num, tl_system); |
97 | num, | 97 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
98 | GNUNET_i2s (peer)); | 98 | "validating peer number %u with identity %s\n", |
99 | GNUNET_TRANSPORT_application_validate (ah, | 99 | num, |
100 | peer, | 100 | GNUNET_i2s (peer)); |
101 | nt, | 101 | GNUNET_TRANSPORT_application_validate (ah, |
102 | addr); | 102 | peer, |
103 | GNUNET_free (peer); | 103 | nt, |
104 | GNUNET_free (addr); | 104 | addr); |
105 | GNUNET_free (peer); | ||
106 | GNUNET_free (addr); | ||
107 | } | ||
105 | } | 108 | } |
106 | } | 109 | } |
107 | cps->con_num = con_num; | 110 | cps->con_num = con_num; |
@@ -119,14 +122,15 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is, | |||
119 | const struct GNUNET_TESTING_Command *cmd; | 122 | const struct GNUNET_TESTING_Command *cmd; |
120 | struct ConnectPeersState *cps; | 123 | struct ConnectPeersState *cps; |
121 | struct GNUNET_PeerIdentity *peer_connection; | 124 | struct GNUNET_PeerIdentity *peer_connection; |
122 | unsigned int con_num = 0; | ||
123 | struct GNUNET_TESTING_NodeConnection *pos_connection; | 125 | struct GNUNET_TESTING_NodeConnection *pos_connection; |
124 | unsigned int num; | 126 | unsigned int num; |
127 | unsigned int con_num; | ||
125 | void *ret = NULL; | 128 | void *ret = NULL; |
126 | 129 | ||
127 | cmd = GNUNET_TESTING_interpreter_lookup_command (is, | 130 | cmd = GNUNET_TESTING_interpreter_lookup_command_all (is, |
128 | "connect-peers"); | 131 | "connect-peers"); |
129 | cps = cmd->cls; | 132 | cps = cmd->cls; |
133 | con_num = cps->con_num; | ||
130 | for (pos_connection = cps->node_connections_head; NULL != pos_connection; | 134 | for (pos_connection = cps->node_connections_head; NULL != pos_connection; |
131 | pos_connection = pos_connection->next) | 135 | pos_connection = pos_connection->next) |
132 | { | 136 | { |
@@ -134,12 +138,14 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is, | |||
134 | peer_connection = GNUNET_TESTING_get_pub_key (num, cps->tl_system); | 138 | peer_connection = GNUNET_TESTING_get_pub_key (num, cps->tl_system); |
135 | if (0 == GNUNET_memcmp (peer, | 139 | if (0 == GNUNET_memcmp (peer, |
136 | peer_connection)) | 140 | peer_connection)) |
137 | con_num++; | 141 | cps->con_num_notified++; |
138 | GNUNET_free (peer_connection); | 142 | GNUNET_free (peer_connection); |
139 | } | 143 | } |
140 | |||
141 | |||
142 | if (cps->con_num == con_num) | 144 | if (cps->con_num == con_num) |
145 | cps->additional_connects_notified++; | ||
146 | |||
147 | if (cps->con_num + cps->additional_connects == cps->con_num_notified | ||
148 | + cps->additional_connects_notified) | ||
143 | { | 149 | { |
144 | GNUNET_TESTING_async_finish (&cps->ac); | 150 | GNUNET_TESTING_async_finish (&cps->ac); |
145 | } | 151 | } |
@@ -205,13 +211,25 @@ GNUNET_TRANSPORT_get_trait_connect_peer_state ( | |||
205 | } | 211 | } |
206 | 212 | ||
207 | 213 | ||
214 | /** | ||
215 | * Create command | ||
216 | * | ||
217 | * @param label name for command | ||
218 | * @param start_peer_label Label of the cmd to start a peer. | ||
219 | * @param create_peer_label Label of the cmd which started the test system. | ||
220 | * @param num Number globally identifying the node. | ||
221 | * @param The topology for the test setup. | ||
222 | * @param additional_connects Number of additional connects this cmd will wait for not triggered by this cmd. | ||
223 | * @return command. | ||
224 | */ | ||
208 | struct GNUNET_TESTING_Command | 225 | struct GNUNET_TESTING_Command |
209 | GNUNET_TRANSPORT_cmd_connect_peers (const char *label, | 226 | GNUNET_TRANSPORT_cmd_connect_peers (const char *label, |
210 | const char *start_peer_label, | 227 | const char *start_peer_label, |
211 | const char *create_label, | 228 | const char *create_label, |
212 | uint32_t num, | 229 | uint32_t num, |
213 | struct GNUNET_TESTING_NetjailTopology * | 230 | struct GNUNET_TESTING_NetjailTopology * |
214 | topology) | 231 | topology, |
232 | unsigned int additional_connects) | ||
215 | { | 233 | { |
216 | struct ConnectPeersState *cps; | 234 | struct ConnectPeersState *cps; |
217 | 235 | ||
@@ -221,6 +239,7 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label, | |||
221 | cps->create_label = create_label; | 239 | cps->create_label = create_label; |
222 | cps->topology = topology; | 240 | cps->topology = topology; |
223 | cps->notify_connect = notify_connect; | 241 | cps->notify_connect = notify_connect; |
242 | cps->additional_connects = additional_connects; | ||
224 | 243 | ||
225 | { | 244 | { |
226 | struct GNUNET_TESTING_Command cmd = { | 245 | struct GNUNET_TESTING_Command cmd = { |