aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api_monitoring.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-01-09 10:42:49 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-01-09 10:42:49 +0000
commit25744888266d74a3dbf444d6b1db2a8d46f9cdfb (patch)
treeaafd9246591779913f7e2b3f3240ca8a3b2ea87f /src/transport/test_transport_api_monitoring.c
parent2ebc43f57aafc7435dc8e344d6ccbf12582e6123 (diff)
downloadgnunet-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.c33
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;
77static char *cfg_file_p2; 77static char *cfg_file_p2;
78 78
79static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc_p1; 79static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc_p1;
80
80static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc_p2; 81static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc_p2;
81 82
83static int p1_c = GNUNET_NO;
84
85static int p2_c = GNUNET_NO;
86
82 87
83static void 88static void
84end () 89end ()
@@ -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
116static void 123static 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}
333static int p1_c = GNUNET_NO;
334static int p2_c = GNUNET_NO;
335 351
336static void done () 352static 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
342static void monitor1_cb (void *cls, 362static 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 */