From: Matthias Wachs Date: Thu, 9 Jan 2014 10:42:49 +0000 (+0000) Subject: fixed return value X-Git-Tag: initial-import-from-subversion-38251~5088 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=25744888266d74a3dbf444d6b1db2a8d46f9cdfb;p=oweals%2Fgnunet.git fixed return value --- 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; static char *cfg_file_p2; static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc_p1; + static struct GNUNET_TRANSPORT_PeerMonitoringContext *pmc_p2; +static int p1_c = GNUNET_NO; + +static int p2_c = GNUNET_NO; + static void end () @@ -111,6 +116,8 @@ end () p1 = NULL; GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); p2 = NULL; + + ok = 0; } static void @@ -153,6 +160,17 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) th = NULL; + if (NULL != pmc_p1) + { + GNUNET_TRANSPORT_monitor_peers_cancel (pmc_p1); + pmc_p1 = NULL; + } + if (NULL != pmc_p2) + { + GNUNET_TRANSPORT_monitor_peers_cancel (pmc_p2); + pmc_p2 = NULL; + } + if (p1 != NULL) GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); else @@ -330,13 +348,15 @@ start_cb (struct PeerContext *p, void *cls) NULL); } -static int p1_c = GNUNET_NO; -static int p2_c = GNUNET_NO; static void done () { if ((GNUNET_YES == p1_c) && (GNUNET_YES == p2_c)) - end(); + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Both peers state to be connected\n"); + ok = 0; + end(); + } } static void monitor1_cb (void *cls, @@ -442,6 +462,8 @@ main (int argc, char *argv[]) { int ret; + ok = 1; + GNUNET_TRANSPORT_TESTING_get_test_name (argv[0], &test_name); GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source); GNUNET_TRANSPORT_TESTING_get_test_plugin_name (argv[0], test_source, @@ -466,7 +488,10 @@ main (int argc, char *argv[]) GNUNET_TRANSPORT_TESTING_done (tth); - return ret; + if (0 != ret) + return ret; + else + return ok; } /* end of test_transport_api.c */