From 4eecf868f0ed39d472884cf6b415bb3b3460dee7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 23 Oct 2016 16:03:36 +0000 Subject: avoid use of CLIENT_service_test which is dying --- src/peerinfo-tool/gnunet-peerinfo.c | 70 +++++++++------------------- src/peerinfo-tool/test_gnunet_peerinfo.py.in | 3 -- 2 files changed, 21 insertions(+), 52 deletions(-) diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c index 67590d2a8..a5907c63f 100644 --- a/src/peerinfo-tool/gnunet-peerinfo.c +++ b/src/peerinfo-tool/gnunet-peerinfo.c @@ -700,24 +700,35 @@ hello_callback (void *cls, /** - * Function called with the result of the check if the PEERINFO - * service is running. + * Main function that will be run by the scheduler. * - * @param cls closure with our configuration - * @param result #GNUNET_YES if PEERINFO is running + * @param cls closure + * @param args remaining command-line arguments + * @param cfgfile name of the configuration file used (for saving, can be NULL!) + * @param c configuration */ static void -testservice_task (void *cls, - int result) +run (void *cls, + char *const *args, + const char *cfgfile, + const struct GNUNET_CONFIGURATION_Handle *c) { - if (GNUNET_YES != result) + cfg = c; + if ( (NULL != args[0]) && + (NULL == put_uri) && + (args[0] == strcasestr (args[0], + "gnunet://hello/")) ) + { + put_uri = GNUNET_strdup (args[0]); + args++; + } + if (NULL != args[0]) { FPRINTF (stderr, - "Service `%s' is not running, please start GNUnet\n", - "peerinfo"); + _("Invalid command line argument `%s'\n"), + args[0]); return; } - if (NULL == (peerinfo = GNUNET_PEERINFO_connect (cfg))) { FPRINTF (stderr, @@ -744,45 +755,6 @@ testservice_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 c configuration - */ -static void -run (void *cls, - char *const *args, - const char *cfgfile, - const struct GNUNET_CONFIGURATION_Handle *c) -{ - cfg = c; - if ( (NULL != args[0]) && - (NULL == put_uri) && - (args[0] == strcasestr (args[0], - "gnunet://hello/")) ) - { - put_uri = GNUNET_strdup (args[0]); - args++; - } - if (NULL != args[0]) - { - FPRINTF (stderr, - _("Invalid command line argument `%s'\n"), - args[0]); - return; - } - - GNUNET_CLIENT_service_test ("peerinfo", - cfg, - GNUNET_TIME_UNIT_SECONDS, - &testservice_task, - (void *) cfg); -} - - /** * Main state machine that goes over all options and * runs the next requested function. diff --git a/src/peerinfo-tool/test_gnunet_peerinfo.py.in b/src/peerinfo-tool/test_gnunet_peerinfo.py.in index a0af9eff3..3207c2c2f 100755 --- a/src/peerinfo-tool/test_gnunet_peerinfo.py.in +++ b/src/peerinfo-tool/test_gnunet_peerinfo.py.in @@ -42,9 +42,6 @@ elif os.name == 'nt': gnunettesting = 'gnunet-testing.exe' pinfo = pexpect () -pinfo.spawn (None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf', '-L', 'ERROR'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) -pinfo.expect ("stdout", re.compile (r'Service `peerinfo\' is not running, please start GNUnet\r?\n')) -pinfo.expect ("stdout", "EOF") if os.name == "nt": -- cgit v1.2.3