From 0890551ed766641630b318db14f86a11802702bb Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Mon, 9 Jul 2012 11:23:49 +0000 Subject: [PATCH] - check if service is running --- src/transport/gnunet-transport.c | 48 ++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index c727a6fec..42b7f6062 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c @@ -607,24 +607,18 @@ shutdown_task (void *cls, } } - - -/** - * Main function that will be run by the scheduler. - * - * @param cls closure - * @param args remaining command-line arguments - * @param cfgfile name of the configuration file used (for saving, can be NULL!) - * @param cfg configuration - */ static void -run (void *cls, char *const *args, const char *cfgfile, - const struct GNUNET_CONFIGURATION_Handle *cfg) +testservice_task (void *cls, + const struct GNUNET_SCHEDULER_TaskContext *tc) { - if (test_configuration) + struct GNUNET_CONFIGURATION_Handle *cfg = cls; + + if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT)) { - do_test_configuration (cfg); + FPRINTF (stderr, _("Service `%s' is not running\n"), "transport"); + return; } + if (benchmark_send && (NULL == cpid)) { FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"), @@ -684,6 +678,32 @@ run (void *cls, char *const *args, const char *cfgfile, NULL); } } + + +} + + +/** + * Main function that will be run by the scheduler. + * + * @param cls closure + * @param args remaining command-line arguments + * @param cfgfile name of the configuration file used (for saving, can be NULL!) + * @param cfg configuration + */ +static void +run (void *cls, char *const *args, const char *cfgfile, + const struct GNUNET_CONFIGURATION_Handle *cfg) +{ + if (test_configuration) + { + do_test_configuration (cfg); + } + + GNUNET_CLIENT_service_test ("transport", cfg, + GNUNET_TIME_UNIT_SECONDS, + &testservice_task, + (void *) cfg); } -- 2.25.1