From: Nathan S. Evans Date: Fri, 17 Sep 2010 15:56:15 +0000 (+0000) Subject: testing api addition X-Git-Tag: initial-import-from-subversion-38251~20311 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=aef68bb1827f5a25832f1ea4b1477295d5a33c2c;p=oweals%2Fgnunet.git testing api addition --- diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h index 10b1d5a87..488d1a94b 100644 --- a/src/include/gnunet_testing_lib.h +++ b/src/include/gnunet_testing_lib.h @@ -447,6 +447,17 @@ GNUNET_TESTING_daemon_start (struct GNUNET_SCHEDULER_Handle *sched, void GNUNET_TESTING_daemon_continue_startup(struct GNUNET_TESTING_Daemon *daemon); +/** + * Check whether the given daemon is running. + * + * @param daemon the daemon to check + * + * @return GNUNET_YES if the daemon is up, GNUNET_NO if the + * daemon is down, GNUNET_SYSERR on error. + */ +int +GNUNET_TESTING_daemon_running (struct GNUNET_TESTING_Daemon *daemon); + /** * Restart (stop and start) a GNUnet daemon. * diff --git a/src/testing/testing.c b/src/testing/testing.c index e493f5f6c..f2150697f 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -696,6 +696,25 @@ GNUNET_TESTING_daemon_continue_startup(struct GNUNET_TESTING_Daemon *daemon) daemon->phase = SP_TOPOLOGY_SETUP; } +/** + * Check whether the given daemon is running. + * + * @param daemon the daemon to check + * + * @return GNUNET_YES if the daemon is up, GNUNET_NO if the + * daemon is down, GNUNET_SYSERR on error. + */ +int +GNUNET_TESTING_daemon_running (struct GNUNET_TESTING_Daemon *daemon) +{ + if (daemon == NULL) + return GNUNET_SYSERR; + + if (daemon->running == GNUNET_YES) + return GNUNET_YES; + return GNUNET_NO; +} + /** * Start a peer that has previously been stopped using the daemon_stop