break;
case SP_TOPOLOGY_SETUP: /* Indicates topology setup has completed! */
/* start GNUnet on remote host */
- fprintf (stderr, "Starting\n");
if (NULL == d->hostname)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
d->phase = SP_START_ARMING;
/* Check if this is a local or remote process */
- fprintf (stderr, "Stopping\n");
if (NULL != d->hostname)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
else
arg = GNUNET_strdup (d->hostname);
- fprintf (stderr, "Stopping\n");
d->proc_arm_srv_stop = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh",
#if !DEBUG_TESTING
"-q",
}
+/**
+ * Forcefully terminate a process and clean up the child.
+ *
+ * @param proc handle to process to kill
+ */
+static void
+kill_and_close_process (struct GNUNET_OS_Process *proc)
+{
+ (void) GNUNET_OS_process_kill (proc, SIGKILL);
+ GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (proc));
+ GNUNET_OS_process_close (proc);
+}
+
+
/**
* Stops a GNUnet daemon.
*
d->dead = GNUNET_YES;
return;
}
-
+ if (NULL != d->proc_arm_start)
+ {
+ kill_and_close_process (d->proc_arm_start);
+ d->proc_arm_start = NULL;
+ }
+ if (NULL != d->proc_arm_srv_start)
+ {
+ kill_and_close_process (d->proc_arm_srv_start);
+ d->proc_arm_srv_start = NULL;
+ }
+ if (NULL != d->proc_arm_srv_stop)
+ {
+ kill_and_close_process (d->proc_arm_srv_stop);
+ d->proc_arm_srv_stop = NULL;
+ }
+ if (NULL != d->proc_arm_copying)
+ {
+ kill_and_close_process (d->proc_arm_copying);
+ d->proc_arm_copying = NULL;
+ }
+ if (NULL != d->proc_arm_peerinfo)
+ {
+ kill_and_close_process (d->proc_arm_peerinfo);
+ d->proc_arm_peerinfo = NULL;
+ }
if ((d->running == GNUNET_NO) && (d->churn == GNUNET_YES)) /* Peer has already been stopped in churn context! */
{
/* Free what was left from churning! */
GNUNET_free_non_null (d->username);
if (NULL != d->dead_cb)
d->dead_cb (d->dead_cb_cls, NULL);
+ GNUNET_assert (NULL == d->proc_arm_stop);
GNUNET_free (d);
return;
}
d->th = NULL;
}
/* Check if this is a local or remote process */
- fprintf (stderr, "Stopping\n");
+
+
if (NULL != d->hostname)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,