diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-10-23 16:03:36 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-10-23 16:03:36 +0000 |
commit | 4eecf868f0ed39d472884cf6b415bb3b3460dee7 (patch) | |
tree | 29f6a714a60cec3f03a55c09f4244bf1ee358f68 | |
parent | a539ef2a879ff65e548aa0bb2ad6de65ba04275a (diff) |
avoid use of CLIENT_service_test which is dying
-rw-r--r-- | src/peerinfo-tool/gnunet-peerinfo.c | 70 | ||||
-rwxr-xr-x | 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 67590d2a8d..a5907c63f4 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, @@ -745,45 +756,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 a0af9eff33..3207c2c2fe 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": |