aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo-tool
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-10-23 16:03:36 +0000
committerChristian Grothoff <christian@grothoff.org>2016-10-23 16:03:36 +0000
commit4eecf868f0ed39d472884cf6b415bb3b3460dee7 (patch)
tree29f6a714a60cec3f03a55c09f4244bf1ee358f68 /src/peerinfo-tool
parenta539ef2a879ff65e548aa0bb2ad6de65ba04275a (diff)
downloadgnunet-4eecf868f0ed39d472884cf6b415bb3b3460dee7.tar.gz
gnunet-4eecf868f0ed39d472884cf6b415bb3b3460dee7.zip
avoid use of CLIENT_service_test which is dying
Diffstat (limited to 'src/peerinfo-tool')
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c70
-rwxr-xr-xsrc/peerinfo-tool/test_gnunet_peerinfo.py.in3
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,
700 700
701 701
702/** 702/**
703 * Function called with the result of the check if the PEERINFO 703 * Main function that will be run by the scheduler.
704 * service is running.
705 * 704 *
706 * @param cls closure with our configuration 705 * @param cls closure
707 * @param result #GNUNET_YES if PEERINFO is running 706 * @param args remaining command-line arguments
707 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
708 * @param c configuration
708 */ 709 */
709static void 710static void
710testservice_task (void *cls, 711run (void *cls,
711 int result) 712 char *const *args,
713 const char *cfgfile,
714 const struct GNUNET_CONFIGURATION_Handle *c)
712{ 715{
713 if (GNUNET_YES != result) 716 cfg = c;
717 if ( (NULL != args[0]) &&
718 (NULL == put_uri) &&
719 (args[0] == strcasestr (args[0],
720 "gnunet://hello/")) )
721 {
722 put_uri = GNUNET_strdup (args[0]);
723 args++;
724 }
725 if (NULL != args[0])
714 { 726 {
715 FPRINTF (stderr, 727 FPRINTF (stderr,
716 "Service `%s' is not running, please start GNUnet\n", 728 _("Invalid command line argument `%s'\n"),
717 "peerinfo"); 729 args[0]);
718 return; 730 return;
719 } 731 }
720
721 if (NULL == (peerinfo = GNUNET_PEERINFO_connect (cfg))) 732 if (NULL == (peerinfo = GNUNET_PEERINFO_connect (cfg)))
722 { 733 {
723 FPRINTF (stderr, 734 FPRINTF (stderr,
@@ -745,45 +756,6 @@ testservice_task (void *cls,
745 756
746 757
747/** 758/**
748 * Main function that will be run by the scheduler.
749 *
750 * @param cls closure
751 * @param args remaining command-line arguments
752 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
753 * @param c configuration
754 */
755static void
756run (void *cls,
757 char *const *args,
758 const char *cfgfile,
759 const struct GNUNET_CONFIGURATION_Handle *c)
760{
761 cfg = c;
762 if ( (NULL != args[0]) &&
763 (NULL == put_uri) &&
764 (args[0] == strcasestr (args[0],
765 "gnunet://hello/")) )
766 {
767 put_uri = GNUNET_strdup (args[0]);
768 args++;
769 }
770 if (NULL != args[0])
771 {
772 FPRINTF (stderr,
773 _("Invalid command line argument `%s'\n"),
774 args[0]);
775 return;
776 }
777
778 GNUNET_CLIENT_service_test ("peerinfo",
779 cfg,
780 GNUNET_TIME_UNIT_SECONDS,
781 &testservice_task,
782 (void *) cfg);
783}
784
785
786/**
787 * Main state machine that goes over all options and 759 * Main state machine that goes over all options and
788 * runs the next requested function. 760 * runs the next requested function.
789 * 761 *
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':
42 gnunettesting = 'gnunet-testing.exe' 42 gnunettesting = 'gnunet-testing.exe'
43 43
44pinfo = pexpect () 44pinfo = pexpect ()
45pinfo.spawn (None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf', '-L', 'ERROR'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
46pinfo.expect ("stdout", re.compile (r'Service `peerinfo\' is not running, please start GNUnet\r?\n'))
47pinfo.expect ("stdout", "EOF")
48 45
49 46
50if os.name == "nt": 47if os.name == "nt":