+ "Starting `%s', with command `%s %s %s %s'.\n",
+ "gnunet-arm", "gnunet-arm", "-c", d->cfgfile,
+ "-s");
+ d->proc_arm_start =
+ GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", "-c",
+ d->cfgfile,
+ "-s", "-q", "-T",
+ GNUNET_TIME_relative_to_string
+ (GNUNET_TIME_absolute_get_remaining
+ (d->max_timeout)), NULL);
+ }
+ else
+ {
+ if (d->username != NULL)
+ GNUNET_asprintf (&dst, "%s@%s", d->username, d->hostname);
+ else
+ dst = GNUNET_strdup (d->hostname);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Starting `%s', with command `%s %s %s %s %s %s %s'.\n",
+ "gnunet-arm", "ssh", dst, "gnunet-arm", "-c", d->cfgfile,
+ "-s", "-q");
+ if (d->ssh_port_str == NULL)
+ {
+ d->proc_arm_start = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
+ "-q",
+ dst, "gnunet-arm",
+ "-c", d->cfgfile, "-s", "-q", "-T",
+ GNUNET_TIME_relative_to_string
+ (GNUNET_TIME_absolute_get_remaining
+ (d->max_timeout)), NULL);
+ }
+ else
+ {
+
+ d->proc_arm_start =
+ GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", "-p",
+ d->ssh_port_str,
+ "-q",
+ dst, "gnunet-arm",
+ "-c", d->cfgfile, "-s", "-q", "-T",
+ GNUNET_TIME_relative_to_string
+ (GNUNET_TIME_absolute_get_remaining
+ (d->max_timeout)), NULL);
+ }
+ GNUNET_free (dst);
+ }
+ if (NULL == d->proc_arm_start)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Could not start `%s' process to start GNUnet.\n"),
+ (NULL == d->hostname) ? "gnunet-arm" : "ssh");
+ cb = d->cb;
+ d->cb = NULL;
+ if (NULL != cb)
+ cb (d->cb_cls, NULL, d->cfg, d,
+ (NULL ==
+ d->hostname) ? _("Failed to start `gnunet-arm' process.\n") :
+ _("Failed to start `ssh' process.\n"));
+ return;
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Started `%s', waiting for `%s' to be up.\n", "gnunet-arm",
+ "gnunet-service-core");
+ d->phase = SP_START_ARMING;
+ d->task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_EXEC_WAIT, &start_fsm,
+ d);
+ // FIXME: busy wait?
+ break;
+ case SP_START_ARMING:
+ if (GNUNET_OK != GNUNET_OS_process_status (d->proc_arm_start, &type, &code))
+ {
+ if (GNUNET_TIME_absolute_get_remaining (d->max_timeout).rel_value == 0)
+ {
+ cb = d->cb;
+ d->cb = NULL;
+ if (NULL != cb)
+ cb (d->cb_cls, NULL, d->cfg, d,
+ (NULL ==
+ d->hostname) ? _("`gnunet-arm' does not seem to terminate.\n") :
+ _("`ssh' does not seem to terminate.\n"));
+ if (d->cfg != NULL)