*/
#include "platform.h"
#include "gnunet_arm_service.h"
-#include "gnunet_client_lib.h"
-#include "gnunet_getopt_lib.h"
-#include "gnunet_os_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
-#include "gnunet_server_lib.h"
#include "arm.h"
#define LOG(kind,...) GNUNET_log_from (kind, "arm-api",__VA_ARGS__)
{
struct RequestContext *pos = cls;
struct GNUNET_OS_Process *proc;
+ char *cbinary;
char *binary;
char *config;
char *loprefix;
lopostfix = GNUNET_strdup ("");
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (pos->h->cfg, "arm", "BINARY",
- &binary))
+ &cbinary))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
"arm", "BINARY");
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (pos->h->cfg, "arm", "CONFIG",
&config))
- {
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
- "arm", "CONFIG");
- if (pos->callback != NULL)
- pos->callback (pos->cls, GNUNET_ARM_PROCESS_UNKNOWN);
- GNUNET_free (binary);
- GNUNET_free (pos);
- GNUNET_free (loprefix);
- GNUNET_free (lopostfix);
- return;
- }
+ config = NULL;
+ binary = GNUNET_OS_get_libexec_binary_path (cbinary);
+ GNUNET_free (cbinary);
if ((GNUNET_YES ==
GNUNET_CONFIGURATION_have_value (pos->h->cfg, "TESTING", "WEAKRANDOM"))
&& (GNUNET_YES ==
{
/* Means we are ONLY running locally */
/* we're clearly running a test, don't daemonize */
- proc = do_start_process (GNUNET_NO, pos->std_inheritance,
- NULL, loprefix, binary, "-c", config,
- /* no daemonization! */
- lopostfix, NULL);
+ if (NULL == config)
+ proc = do_start_process (GNUNET_NO, pos->std_inheritance,
+ NULL, loprefix, binary,
+ /* no daemonization! */
+ lopostfix, NULL);
+ else
+ proc = do_start_process (GNUNET_NO, pos->std_inheritance,
+ NULL, loprefix, binary, "-c", config,
+ /* no daemonization! */
+ lopostfix, NULL);
}
else
{
- proc = do_start_process (GNUNET_NO, pos->std_inheritance,
- NULL, loprefix, binary, "-c", config,
- "-d", lopostfix, NULL);
+ if (NULL == config)
+ proc = do_start_process (GNUNET_NO, pos->std_inheritance,
+ NULL, loprefix, binary,
+ "-d", lopostfix, NULL);
+ else
+ proc = do_start_process (GNUNET_NO, pos->std_inheritance,
+ NULL, loprefix, binary, "-c", config,
+ "-d", lopostfix, NULL);
}
GNUNET_free (binary);
- GNUNET_free (config);
+ GNUNET_free_non_null (config);
GNUNET_free (loprefix);
GNUNET_free (lopostfix);
- if (proc == NULL)
- {
- if (pos->callback != NULL)
- pos->callback (pos->cls, GNUNET_ARM_PROCESS_FAILURE);
- GNUNET_free (pos);
- return;
- }
+ if (NULL == proc)
+ {
+ if (pos->callback != NULL)
+ pos->callback (pos->cls, GNUNET_ARM_PROCESS_FAILURE);
+ GNUNET_free (pos);
+ return;
+ }
if (pos->callback != NULL)
pos->callback (pos->cls, GNUNET_ARM_PROCESS_STARTING);
GNUNET_free (proc);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Asked to start service `%s' within %s\n", service_name,
- GNUNET_STRINGS_relative_time_to_string (timeout));
+ GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO));
if (0 == strcasecmp ("arm", service_name))
{
slen = strlen ("arm") + 1;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Stopping service `%s' within %s\n",
service_name,
- GNUNET_STRINGS_relative_time_to_string (timeout));
+ GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO));
if (h->client == NULL)
{
client = GNUNET_CLIENT_connect ("arm", h->cfg);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Requesting LIST from ARM service with timeout: %s\n",
- GNUNET_STRINGS_relative_time_to_string (timeout));
+ GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_YES));
if (GNUNET_OK !=
GNUNET_CLIENT_transmit_and_get_response (sctx->h->client,