[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20404 - gnunet/src/testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20404 - gnunet/src/testing |
Date: |
Fri, 9 Mar 2012 13:30:02 +0100 |
Author: grothoff
Date: 2012-03-09 13:30:02 +0100 (Fri, 09 Mar 2012)
New Revision: 20404
Modified:
gnunet/src/testing/testing.c
Log:
-fixing #2190 by actually stopping all child processes cleanly
Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c 2012-03-09 12:23:55 UTC (rev 20403)
+++ gnunet/src/testing/testing.c 2012-03-09 12:30:02 UTC (rev 20404)
@@ -415,7 +415,6 @@
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,
@@ -1329,7 +1328,6 @@
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,
@@ -1421,7 +1419,6 @@
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",
@@ -1459,6 +1456,20 @@
/**
+ * 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.
*
* @param d the daemon that should be stopped
@@ -1489,7 +1500,31 @@
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! */
@@ -1507,6 +1542,7 @@
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;
}
@@ -1544,7 +1580,8 @@
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,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20404 - gnunet/src/testing,
gnunet <=