diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-01-15 17:18:11 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-01-15 17:18:11 +0000 |
commit | 2368c95a00afc72a8f03ab67bca1ff41328eecdf (patch) | |
tree | 3bcbc29808d7e91c85ca60ac5c998374b458862e /src/transport/test_transport_api_monitoring.c | |
parent | b0144a11f14f33ab010fd7cf8c61bdd361f20fd3 (diff) | |
download | gnunet-2368c95a00afc72a8f03ab67bca1ff41328eecdf.tar.gz gnunet-2368c95a00afc72a8f03ab67bca1ff41328eecdf.zip |
transport validation monitoring API (not yet complete) + CLI
+ fix for crash in transport/plugin_transport_udp.c
Diffstat (limited to 'src/transport/test_transport_api_monitoring.c')
-rw-r--r-- | src/transport/test_transport_api_monitoring.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/transport/test_transport_api_monitoring.c b/src/transport/test_transport_api_monitoring.c index f726344dd..0767893ed 100644 --- a/src/transport/test_transport_api_monitoring.c +++ b/src/transport/test_transport_api_monitoring.c | |||
@@ -98,15 +98,20 @@ end () | |||
98 | GNUNET_SCHEDULER_cancel (send_task); | 98 | GNUNET_SCHEDULER_cancel (send_task); |
99 | 99 | ||
100 | if (die_task != GNUNET_SCHEDULER_NO_TASK) | 100 | if (die_task != GNUNET_SCHEDULER_NO_TASK) |
101 | { | ||
101 | GNUNET_SCHEDULER_cancel (die_task); | 102 | GNUNET_SCHEDULER_cancel (die_task); |
103 | die_task = GNUNET_SCHEDULER_NO_TASK; | ||
104 | } | ||
102 | 105 | ||
103 | if (th != NULL) | 106 | if (th != NULL) |
104 | GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); | 107 | GNUNET_TRANSPORT_notify_transmit_ready_cancel (th); |
105 | th = NULL; | 108 | th = NULL; |
106 | 109 | ||
107 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); | 110 | if (NULL != p1) |
111 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); | ||
108 | p1 = NULL; | 112 | p1 = NULL; |
109 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); | 113 | if (NULL != p2) |
114 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); | ||
110 | p2 = NULL; | 115 | p2 = NULL; |
111 | 116 | ||
112 | if (NULL != pmc_p1) | 117 | if (NULL != pmc_p1) |
@@ -382,8 +387,8 @@ static void monitor1_cb (void *cls, | |||
382 | if ((NULL == peer) || (NULL == p1)) | 387 | if ((NULL == peer) || (NULL == p1)) |
383 | return; | 388 | return; |
384 | 389 | ||
385 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Monitor 1: %s %s %s\n", | 390 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Monitor 1: %s %s %s\n", |
386 | GNUNET_i2s (peer), GNUNET_TRANSPORT_p2s(state), GNUNET_STRINGS_absolute_time_to_string(state_timeout)); | 391 | GNUNET_i2s (peer), GNUNET_TRANSPORT_ps2s(state), GNUNET_STRINGS_absolute_time_to_string(state_timeout)); |
387 | if ((0 == memcmp (peer, &p2->id, sizeof (p2->id)) && | 392 | if ((0 == memcmp (peer, &p2->id, sizeof (p2->id)) && |
388 | (GNUNET_YES == GNUNET_TRANSPORT_is_connected(state)) && | 393 | (GNUNET_YES == GNUNET_TRANSPORT_is_connected(state)) && |
389 | GNUNET_NO == p1_c) ) | 394 | GNUNET_NO == p1_c) ) |
@@ -404,8 +409,8 @@ static void monitor2_cb (void *cls, | |||
404 | if ((NULL == peer) || (NULL == p2)) | 409 | if ((NULL == peer) || (NULL == p2)) |
405 | return; | 410 | return; |
406 | 411 | ||
407 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Monitor 2: %s %s %s\n", | 412 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Monitor 2: %s %s %s\n", |
408 | GNUNET_i2s (peer), GNUNET_TRANSPORT_p2s (state), GNUNET_STRINGS_absolute_time_to_string(state_timeout)); | 413 | GNUNET_i2s (peer), GNUNET_TRANSPORT_ps2s (state), GNUNET_STRINGS_absolute_time_to_string(state_timeout)); |
409 | if ((0 == memcmp (peer, &p1->id, sizeof (p1->id)) && | 414 | if ((0 == memcmp (peer, &p1->id, sizeof (p1->id)) && |
410 | (GNUNET_YES == GNUNET_TRANSPORT_is_connected(state)) && | 415 | (GNUNET_YES == GNUNET_TRANSPORT_is_connected(state)) && |
411 | GNUNET_NO == p2_c) ) | 416 | GNUNET_NO == p2_c) ) |
@@ -432,13 +437,14 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
432 | ¬ify_disconnect, &start_cb, | 437 | ¬ify_disconnect, &start_cb, |
433 | NULL); | 438 | NULL); |
434 | pmc_p1 = GNUNET_TRANSPORT_monitor_peers (p1->cfg, NULL, GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_REL, &monitor1_cb, NULL); | 439 | pmc_p1 = GNUNET_TRANSPORT_monitor_peers (p1->cfg, NULL, GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_REL, &monitor1_cb, NULL); |
440 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer 1 started\n"); | ||
435 | 441 | ||
436 | p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth, cfg_file_p2, 2, | 442 | p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth, cfg_file_p2, 2, |
437 | ¬ify_receive, ¬ify_connect, | 443 | ¬ify_receive, ¬ify_connect, |
438 | ¬ify_disconnect, &start_cb, | 444 | ¬ify_disconnect, &start_cb, |
439 | NULL); | 445 | NULL); |
440 | pmc_p2 = GNUNET_TRANSPORT_monitor_peers (p2->cfg, NULL, GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_REL, &monitor2_cb, NULL); | 446 | pmc_p2 = GNUNET_TRANSPORT_monitor_peers (p2->cfg, NULL, GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_REL, &monitor2_cb, NULL); |
441 | 447 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer 1 started\n"); | |
442 | if ((p1 == NULL) || (p2 == NULL)) | 448 | if ((p1 == NULL) || (p2 == NULL)) |
443 | { | 449 | { |
444 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); | 450 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail! Could not start peers!\n"); |