diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-05-16 13:22:52 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-05-16 13:22:52 +0000 |
commit | 0e711c15d015f2270c240765ebe9c1268eee70e8 (patch) | |
tree | f06b8a25f0137c210bb0f8250dd5f49ad7ee6300 /src/transport/test_transport_api_restart_2peers.c | |
parent | fceae1fb62128bf030a577e8811fc2d2a1bdd265 (diff) | |
download | gnunet-0e711c15d015f2270c240765ebe9c1268eee70e8.tar.gz gnunet-0e711c15d015f2270c240765ebe9c1268eee70e8.zip |
-fixing testcases, cleanup
Diffstat (limited to 'src/transport/test_transport_api_restart_2peers.c')
-rw-r--r-- | src/transport/test_transport_api_restart_2peers.c | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/src/transport/test_transport_api_restart_2peers.c b/src/transport/test_transport_api_restart_2peers.c index 86758dfe6..9fd9c0da6 100644 --- a/src/transport/test_transport_api_restart_2peers.c +++ b/src/transport/test_transport_api_restart_2peers.c | |||
@@ -36,9 +36,6 @@ | |||
36 | #include "transport.h" | 36 | #include "transport.h" |
37 | #include "transport-testing.h" | 37 | #include "transport-testing.h" |
38 | 38 | ||
39 | #define VERBOSE GNUNET_NO | ||
40 | #define VERBOSE_ARM GNUNET_NO | ||
41 | |||
42 | #define START_ARM GNUNET_YES | 39 | #define START_ARM GNUNET_YES |
43 | 40 | ||
44 | /** | 41 | /** |
@@ -63,28 +60,22 @@ static GNUNET_SCHEDULER_TaskIdentifier send_task; | |||
63 | 60 | ||
64 | static GNUNET_SCHEDULER_TaskIdentifier reconnect_task; | 61 | static GNUNET_SCHEDULER_TaskIdentifier reconnect_task; |
65 | 62 | ||
66 | struct PeerContext *p1; | 63 | static struct PeerContext *p1; |
67 | 64 | ||
68 | struct PeerContext *p2; | 65 | static struct PeerContext *p2; |
69 | 66 | ||
70 | static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; | 67 | static GNUNET_TRANSPORT_TESTING_ConnectRequest cc; |
71 | 68 | ||
72 | struct GNUNET_TRANSPORT_TransmitHandle *th; | 69 | static struct GNUNET_TRANSPORT_TransmitHandle *th; |
73 | 70 | ||
74 | struct GNUNET_TRANSPORT_TESTING_handle *tth; | 71 | static struct GNUNET_TRANSPORT_TESTING_handle *tth; |
75 | 72 | ||
76 | char *cfg_file_p1; | 73 | static char *cfg_file_p1; |
77 | 74 | ||
78 | char *cfg_file_p2; | 75 | static char *cfg_file_p2; |
79 | 76 | ||
80 | static int restarted; | 77 | static int restarted; |
81 | 78 | ||
82 | #if VERBOSE | ||
83 | #define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) | ||
84 | #else | ||
85 | #define OKPP do { ok++; } while (0) | ||
86 | #endif | ||
87 | |||
88 | 79 | ||
89 | static void | 80 | static void |
90 | end () | 81 | end () |
@@ -345,8 +336,12 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
345 | if (th != NULL) | 336 | if (th != NULL) |
346 | GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); | 337 | GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); |
347 | th = NULL; | 338 | th = NULL; |
339 | if (GNUNET_SCHEDULER_NO_TASK != send_task) | ||
340 | GNUNET_SCHEDULER_cancel (send_task); | ||
341 | send_task = GNUNET_SCHEDULER_NO_TASK; | ||
348 | } | 342 | } |
349 | 343 | ||
344 | |||
350 | static void | 345 | static void |
351 | testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) | 346 | testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) |
352 | { | 347 | { |
@@ -362,7 +357,7 @@ testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) | |||
362 | 357 | ||
363 | 358 | ||
364 | 359 | ||
365 | void | 360 | static void |
366 | start_cb (struct PeerContext *p, void *cls) | 361 | start_cb (struct PeerContext *p, void *cls) |
367 | { | 362 | { |
368 | static int started; | 363 | static int started; |
@@ -420,9 +415,6 @@ check () | |||
420 | static char *const argv[] = { "test-transport-api", | 415 | static char *const argv[] = { "test-transport-api", |
421 | "-c", | 416 | "-c", |
422 | "test_transport_api_data.conf", | 417 | "test_transport_api_data.conf", |
423 | #if VERBOSE | ||
424 | "-L", "DEBUG", | ||
425 | #endif | ||
426 | NULL | 418 | NULL |
427 | }; | 419 | }; |
428 | static struct GNUNET_GETOPT_CommandLineOption options[] = { | 420 | static struct GNUNET_GETOPT_CommandLineOption options[] = { |
@@ -447,30 +439,17 @@ main (int argc, char *argv[]) | |||
447 | int ret; | 439 | int ret; |
448 | 440 | ||
449 | GNUNET_TRANSPORT_TESTING_get_test_name (argv[0], &test_name); | 441 | GNUNET_TRANSPORT_TESTING_get_test_name (argv[0], &test_name); |
450 | |||
451 | |||
452 | GNUNET_log_setup (test_name, | 442 | GNUNET_log_setup (test_name, |
453 | #if VERBOSE | ||
454 | "DEBUG", | ||
455 | #else | ||
456 | "WARNING", | 443 | "WARNING", |
457 | #endif | ||
458 | NULL); | 444 | NULL); |
459 | |||
460 | tth = GNUNET_TRANSPORT_TESTING_init (); | 445 | tth = GNUNET_TRANSPORT_TESTING_init (); |
461 | |||
462 | GNUNET_asprintf (&cfg_file_p1, "test_transport_api_tcp_peer1.conf"); | 446 | GNUNET_asprintf (&cfg_file_p1, "test_transport_api_tcp_peer1.conf"); |
463 | GNUNET_asprintf (&cfg_file_p2, "test_transport_api_tcp_peer2.conf"); | 447 | GNUNET_asprintf (&cfg_file_p2, "test_transport_api_tcp_peer2.conf"); |
464 | |||
465 | ret = check (); | 448 | ret = check (); |
466 | |||
467 | GNUNET_free (cfg_file_p1); | 449 | GNUNET_free (cfg_file_p1); |
468 | GNUNET_free (cfg_file_p2); | 450 | GNUNET_free (cfg_file_p2); |
469 | |||
470 | GNUNET_free (test_name); | 451 | GNUNET_free (test_name); |
471 | |||
472 | GNUNET_TRANSPORT_TESTING_done (tth); | 452 | GNUNET_TRANSPORT_TESTING_done (tth); |
473 | |||
474 | return ret; | 453 | return ret; |
475 | } | 454 | } |
476 | 455 | ||