[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32745 - gnunet/src/core
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32745 - gnunet/src/core |
Date: |
Fri, 21 Mar 2014 20:34:21 +0100 |
Author: wachs
Date: 2014-03-21 20:34:21 +0100 (Fri, 21 Mar 2014)
New Revision: 32745
Modified:
gnunet/src/core/gnunet-core.c
Log:
print message if service is not running
Modified: gnunet/src/core/gnunet-core.c
===================================================================
--- gnunet/src/core/gnunet-core.c 2014-03-21 18:44:55 UTC (rev 32744)
+++ gnunet/src/core/gnunet-core.c 2014-03-21 19:34:21 UTC (rev 32745)
@@ -143,29 +143,35 @@
}
}
-
/**
- * Main function that will be run by the scheduler.
+ * Function called with the result of the check if the 'transport'
+ * service 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 cfg configuration
+ * @param cls closure with our configuration
+ * @param result #GNUNET_YES if transport is running
*/
static void
-run (void *cls, char *const *args, const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
+testservice_task (void *cls, int result)
{
+ const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
static const struct GNUNET_CORE_MessageHandler handlers[] = {
{NULL, 0, 0}
};
- if (args[0] != NULL)
+
+ if (result != GNUNET_OK)
+ {
+ FPRINTF (stderr, _("Service `%s' is not running\n"), "core");
+ return;
+ }
+
+ if (GNUNET_NO == monitor_connections)
{
- FPRINTF (stderr, _("Invalid command line argument `%s'\n"), args[0]);
- return;
+ if (GNUNET_OK != GNUNET_CORE_iterate_peers (cfg, &connected_peer_callback,
NULL))
+ {
+ fprintf (stderr, ("Failed to connect to CORE service to iterate
peers!\n"));
+ return;
+ }
}
- if (GNUNET_NO == monitor_connections)
- GNUNET_CORE_iterate_peers (cfg, &connected_peer_callback, NULL);
else
{
memset(&my_id, '\0', sizeof (my_id));
@@ -178,13 +184,39 @@
handlers);
if (NULL == ch)
+ {
GNUNET_SCHEDULER_add_now (shutdown_task, NULL);
+ fprintf (stderr, ("Failed to connect to CORE service!\n"));
+ return;
+ }
else
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
shutdown_task, 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 (args[0] != NULL)
+ {
+ FPRINTF (stderr, _("Invalid command line argument `%s'\n"), args[0]);
+ return;
+ }
+ GNUNET_CLIENT_service_test ("core", cfg, GNUNET_TIME_UNIT_SECONDS,
+ &testservice_task, (void *) cfg);
+}
+
+
/**
* The main function to obtain peer information.
*
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32745 - gnunet/src/core,
gnunet <=