diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-01-09 10:42:49 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-01-09 10:42:49 +0000 |
commit | 25744888266d74a3dbf444d6b1db2a8d46f9cdfb (patch) | |
tree | aafd9246591779913f7e2b3f3240ca8a3b2ea87f /src/transport/test_transport_api_monitoring.c | |
parent | 2ebc43f57aafc7435dc8e344d6ccbf12582e6123 (diff) | |
download | gnunet-25744888266d74a3dbf444d6b1db2a8d46f9cdfb.tar.gz gnunet-25744888266d74a3dbf444d6b1db2a8d46f9cdfb.zip |
fixed return value
Diffstat (limited to 'src/transport/test_transport_api_monitoring.c')
-rw-r--r-- | src/transport/test_transport_api_monitoring.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/transport/test_transport_api_monitoring.c b/src/transport/test_transport_api_monitoring.c index dc2a8b097..d06ac6381 100644 --- a/src/transport/test_transport_api_monitoring.c +++ b/src/transport/test_transport_api_monitoring.c | |||
@@ -77,8 +77,13 @@ static char *cfg_file_p1; | |||
77 | static char *cfg_file_p2; | 77 | static char *cfg_file_p2; |
78 | 78 | ||
79 | static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc_p1; | 79 | static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc_p1; |
80 | |||
80 | static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc_p2; | 81 | static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc_p2; |
81 | 82 | ||
83 | static int p1_c = GNUNET_NO; | ||
84 | |||
85 | static int p2_c = GNUNET_NO; | ||
86 | |||
82 | 87 | ||
83 | static void | 88 | static void |
84 | end () | 89 | end () |
@@ -111,6 +116,8 @@ end () | |||
111 | p1 = NULL; | 116 | p1 = NULL; |
112 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); | 117 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); |
113 | p2 = NULL; | 118 | p2 = NULL; |
119 | |||
120 | ok = 0; | ||
114 | } | 121 | } |
115 | 122 | ||
116 | static void | 123 | static void |
@@ -153,6 +160,17 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
153 | 160 | ||
154 | th = NULL; | 161 | th = NULL; |
155 | 162 | ||
163 | if (NULL != pmc_p1) | ||
164 | { | ||
165 | GNUNET_TRANSPORT_monitor_peers_cancel (pmc_p1); | ||
166 | pmc_p1 = NULL; | ||
167 | } | ||
168 | if (NULL != pmc_p2) | ||
169 | { | ||
170 | GNUNET_TRANSPORT_monitor_peers_cancel (pmc_p2); | ||
171 | pmc_p2 = NULL; | ||
172 | } | ||
173 | |||
156 | if (p1 != NULL) | 174 | if (p1 != NULL) |
157 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); | 175 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); |
158 | else | 176 | else |
@@ -330,13 +348,15 @@ start_cb (struct PeerContext *p, void *cls) | |||
330 | NULL); | 348 | NULL); |
331 | 349 | ||
332 | } | 350 | } |
333 | static int p1_c = GNUNET_NO; | ||
334 | static int p2_c = GNUNET_NO; | ||
335 | 351 | ||
336 | static void done () | 352 | static void done () |
337 | { | 353 | { |
338 | if ((GNUNET_YES == p1_c) && (GNUNET_YES == p2_c)) | 354 | if ((GNUNET_YES == p1_c) && (GNUNET_YES == p2_c)) |
339 | end(); | 355 | { |
356 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Both peers state to be connected\n"); | ||
357 | ok = 0; | ||
358 | end(); | ||
359 | } | ||
340 | } | 360 | } |
341 | 361 | ||
342 | static void monitor1_cb (void *cls, | 362 | static void monitor1_cb (void *cls, |
@@ -442,6 +462,8 @@ main (int argc, char *argv[]) | |||
442 | { | 462 | { |
443 | int ret; | 463 | int ret; |
444 | 464 | ||
465 | ok = 1; | ||
466 | |||
445 | GNUNET_TRANSPORT_TESTING_get_test_name (argv[0], &test_name); | 467 | GNUNET_TRANSPORT_TESTING_get_test_name (argv[0], &test_name); |
446 | GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source); | 468 | GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source); |
447 | GNUNET_TRANSPORT_TESTING_get_test_plugin_name (argv[0], test_source, | 469 | GNUNET_TRANSPORT_TESTING_get_test_plugin_name (argv[0], test_source, |
@@ -466,7 +488,10 @@ main (int argc, char *argv[]) | |||
466 | 488 | ||
467 | GNUNET_TRANSPORT_TESTING_done (tth); | 489 | GNUNET_TRANSPORT_TESTING_done (tth); |
468 | 490 | ||
469 | return ret; | 491 | if (0 != ret) |
492 | return ret; | ||
493 | else | ||
494 | return ok; | ||
470 | } | 495 | } |
471 | 496 | ||
472 | /* end of test_transport_api.c */ | 497 | /* end of test_transport_api.c */ |