X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Ftransport%2Ftest_transport_testing.c;h=7875f1cfa191709382eb386b6529ba37e63eaa10;hb=56389a7d277b05c9c2968b7ebd529a12f8be15eb;hp=996ea054357cc62a1783156ca06a5cf2a4542ce2;hpb=83b19539f4d322b43683f5838b72e9ec2c8e6073;p=oweals%2Fgnunet.git diff --git a/src/transport/test_transport_testing.c b/src/transport/test_transport_testing.c index 996ea0543..7875f1cfa 100644 --- a/src/transport/test_transport_testing.c +++ b/src/transport/test_transport_testing.c @@ -27,22 +27,8 @@ * C code apparently. */ #include "platform.h" -#include "gnunet_common.h" -#include "gnunet_hello_lib.h" -#include "gnunet_getopt_lib.h" -#include "gnunet_os_lib.h" -#include "gnunet_program_lib.h" -#include "gnunet_scheduler_lib.h" #include "gnunet_transport_service.h" -#include "transport.h" #include "transport-testing.h" - -#define VERBOSE GNUNET_EXTRA_LOGGING - -#define VERBOSE_ARM GNUNET_EXTRA_LOGGING - -#define START_ARM GNUNET_YES - /** * How long until we give up on transmitting the message? */ @@ -81,6 +67,12 @@ end_badly () timeout_task = GNUNET_SCHEDULER_NO_TASK; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); + if (NULL != cc) + { + GNUNET_TRANSPORT_TESTING_connect_peers_cancel (tth, cc); + cc = NULL; + } + if (p1 != NULL) GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); if (p2 != NULL) @@ -94,7 +86,7 @@ end_badly () static void testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) { - char *ps = strdup (GNUNET_i2s (&p1->id)); + char *ps = GNUNET_strdup (GNUNET_i2s (&p1->id)); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %u (`%4s') connected to peer %u (`%s')!\n", p1->no, ps, @@ -140,11 +132,12 @@ start_cb (struct PeerContext *p, void *cls) if (started != 2) return; - char *sender_c = strdup (GNUNET_i2s (&p1->id)); + char *sender_c = GNUNET_strdup (GNUNET_i2s (&p1->id)); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test tries to connect peer %u (`%s') -> peer %u (`%s')\n", p1->no, sender_c, p2->no, GNUNET_i2s (&p2->id)); + GNUNET_free (sender_c); cc = GNUNET_TRANSPORT_TESTING_connect_peers (tth, p1, p2, &testing_connect_cb, NULL); @@ -165,6 +158,7 @@ run (void *cls, char *const *args, const char *cfgfile, "test_transport_api_tcp_peer1.conf", 1, ¬ify_receive, ¬ify_connect, ¬ify_disconnect, &start_cb, p1); + p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth, "test_transport_api_tcp_peer2.conf", 2, ¬ify_receive, ¬ify_connect, @@ -192,19 +186,12 @@ int main (int argc, char *argv[]) { GNUNET_log_setup ("test_transport_testing", -#if VERBOSE - "DEBUG", -#else "WARNING", -#endif NULL); char *const argv_1[] = { "test_transport_testing", "-c", "test_transport_api_data.conf", -#if VERBOSE - "-L", "DEBUG", -#endif NULL };