diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-04-06 11:59:48 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-04-06 11:59:48 +0000 |
commit | 1855369609fd355f9bfe7de1d7a013fa256b3281 (patch) | |
tree | 1240e4fc135d0878c7f69b7281c59dd9fc0adbb0 /src/transport/test_transport_ats.c | |
parent | 7c14f79654d27ea0bd06784b58a6f9e95064ecaf (diff) | |
download | gnunet-1855369609fd355f9bfe7de1d7a013fa256b3281.tar.gz gnunet-1855369609fd355f9bfe7de1d7a013fa256b3281.zip |
Diffstat (limited to 'src/transport/test_transport_ats.c')
-rw-r--r-- | src/transport/test_transport_ats.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/transport/test_transport_ats.c b/src/transport/test_transport_ats.c index fa2bb407b..ac10ba1c8 100644 --- a/src/transport/test_transport_ats.c +++ b/src/transport/test_transport_ats.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "gnunet_scheduler_lib.h" | 26 | #include "gnunet_scheduler_lib.h" |
27 | #include "gauger.h" | 27 | #include "gauger.h" |
28 | 28 | ||
29 | #define VERBOSE GNUNET_YES | 29 | #define VERBOSE GNUNET_NO |
30 | 30 | ||
31 | #define NUM_PEERS 11 | 31 | #define NUM_PEERS 11 |
32 | #define MEASUREMENTS 5 | 32 | #define MEASUREMENTS 5 |
@@ -70,6 +70,7 @@ struct GNUNET_STATISTICS_GetHandle * s_time; | |||
70 | struct GNUNET_STATISTICS_GetHandle * s_peers; | 70 | struct GNUNET_STATISTICS_GetHandle * s_peers; |
71 | struct GNUNET_STATISTICS_GetHandle * s_mechs; | 71 | struct GNUNET_STATISTICS_GetHandle * s_mechs; |
72 | struct GNUNET_STATISTICS_GetHandle * s_duration; | 72 | struct GNUNET_STATISTICS_GetHandle * s_duration; |
73 | struct GNUNET_STATISTICS_GetHandle * s_invalid; | ||
73 | 74 | ||
74 | /** | 75 | /** |
75 | * Check whether peers successfully shut down. | 76 | * Check whether peers successfully shut down. |
@@ -136,7 +137,6 @@ static void shutdown_peers() | |||
136 | s_duration = NULL; | 137 | s_duration = NULL; |
137 | } | 138 | } |
138 | 139 | ||
139 | |||
140 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 140 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
141 | } | 141 | } |
142 | 142 | ||
@@ -180,6 +180,20 @@ int stats_cb (void *cls, | |||
180 | uint64_t value, | 180 | uint64_t value, |
181 | int is_persistent) | 181 | int is_persistent) |
182 | { | 182 | { |
183 | |||
184 | if (0 == strcmp (name,"ATS invalid solutions")) | ||
185 | { | ||
186 | if (stats_task != GNUNET_SCHEDULER_NO_TASK) | ||
187 | { | ||
188 | GNUNET_SCHEDULER_cancel(stats_task); | ||
189 | stats_task = GNUNET_SCHEDULER_NO_TASK; | ||
190 | } | ||
191 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"MLP produced invalid %llu result(s)!\n", value); | ||
192 | shutdown_peers(); | ||
193 | return GNUNET_SYSERR; | ||
194 | } | ||
195 | |||
196 | |||
183 | if (0 == strcmp (name,"ATS solution")) | 197 | if (0 == strcmp (name,"ATS solution")) |
184 | { | 198 | { |
185 | s_solution = NULL; | 199 | s_solution = NULL; |
@@ -235,6 +249,7 @@ int stats_cb (void *cls, | |||
235 | fprintf(stderr, ".."); | 249 | fprintf(stderr, ".."); |
236 | 250 | ||
237 | results[r_index].timestamp = value; | 251 | results[r_index].timestamp = value; |
252 | return GNUNET_SYSERR; | ||
238 | } | 253 | } |
239 | //GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "[%i] ATS solution: %s %llu \n", r_index, name, value); | 254 | //GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "[%i] ATS solution: %s %llu \n", r_index, name, value); |
240 | } | 255 | } |
@@ -280,6 +295,8 @@ stats_get_task (void *cls, | |||
280 | s_duration = GNUNET_STATISTICS_get (stats, "transport","ATS duration", TIMEOUT, NULL, &stats_cb, NULL); | 295 | s_duration = GNUNET_STATISTICS_get (stats, "transport","ATS duration", TIMEOUT, NULL, &stats_cb, NULL); |
281 | s_peers = GNUNET_STATISTICS_get (stats, "transport", "ATS peers", TIMEOUT, NULL, &stats_cb, NULL); | 296 | s_peers = GNUNET_STATISTICS_get (stats, "transport", "ATS peers", TIMEOUT, NULL, &stats_cb, NULL); |
282 | s_mechs = GNUNET_STATISTICS_get (stats, "transport", "ATS mechanisms", TIMEOUT, NULL, &stats_cb, NULL); | 297 | s_mechs = GNUNET_STATISTICS_get (stats, "transport", "ATS mechanisms", TIMEOUT, NULL, &stats_cb, NULL); |
298 | s_mechs = GNUNET_STATISTICS_get (stats, "transport", "ATS invalid solutions", TIMEOUT, NULL, &stats_cb, NULL); | ||
299 | |||
283 | 300 | ||
284 | stats_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250), &stats_get_task, NULL); | 301 | stats_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250), &stats_get_task, NULL); |
285 | } | 302 | } |
@@ -376,7 +393,7 @@ daemon_start_cb (void *cls, | |||
376 | { | 393 | { |
377 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 394 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
378 | "Too many peers failed, ending test!\n"); | 395 | "Too many peers failed, ending test!\n"); |
379 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 396 | shutdown_peers(); |
380 | ok = 1; | 397 | ok = 1; |
381 | } | 398 | } |
382 | } | 399 | } |
@@ -435,6 +452,7 @@ main (int argc, char *argv[]) | |||
435 | "WARNING", | 452 | "WARNING", |
436 | #endif | 453 | #endif |
437 | NULL); | 454 | NULL); |
455 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-testing"); | ||
438 | 456 | ||
439 | peers = NUM_PEERS; | 457 | peers = NUM_PEERS; |
440 | if (argc >= 2) | 458 | if (argc >= 2) |