aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-helper-testbed.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-04-26 08:47:58 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-04-26 08:47:58 +0000
commita5e2b65182c5e73f723f2b49d07aabfbe54ad112 (patch)
treec04c725718c5940908990b275f0d6c2d54de75b3 /src/testbed/gnunet-helper-testbed.c
parent45b8f1cfb99e0f75139fb935763556c8dc39807b (diff)
downloadgnunet-a5e2b65182c5e73f723f2b49d07aabfbe54ad112.tar.gz
gnunet-a5e2b65182c5e73f723f2b49d07aabfbe54ad112.zip
- signal termination to peers when controller crashes
Diffstat (limited to 'src/testbed/gnunet-helper-testbed.c')
-rw-r--r--src/testbed/gnunet-helper-testbed.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/testbed/gnunet-helper-testbed.c b/src/testbed/gnunet-helper-testbed.c
index bdd8911de..be9154fdc 100644
--- a/src/testbed/gnunet-helper-testbed.c
+++ b/src/testbed/gnunet-helper-testbed.c
@@ -29,7 +29,10 @@
29 * This helper monitors for three termination events. They are: (1)The 29 * This helper monitors for three termination events. They are: (1)The
30 * stdin of the helper is closed for reading; (2)the helper received 30 * stdin of the helper is closed for reading; (2)the helper received
31 * SIGTERM/SIGINT; (3)the testbed crashed. In case of events 1 and 2 31 * SIGTERM/SIGINT; (3)the testbed crashed. In case of events 1 and 2
32 * the helper kills the testbed service. 32 * the helper kills the testbed service. When testbed crashed (event
33 * 3), the helper should send a SIGTERM to its own process group; this
34 * behaviour will help terminate any child processes (peers) testbed
35 * has started and prevents them from leaking and running forever.
33 * 36 *
34 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 37 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
35 */ 38 */
@@ -294,7 +297,12 @@ child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
294 { 297 {
295 GNUNET_OS_process_destroy (testbed); 298 GNUNET_OS_process_destroy (testbed);
296 testbed = NULL; 299 testbed = NULL;
297 shutdown_now (); 300 /* Send SIGTERM to our process group */
301 if (0 != PLIBC_KILL (0, SIGTERM))
302 {
303 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "signal");
304 shutdown_now (); /* Couldn't send the signal, we shutdown frowning */
305 }
298 return; 306 return;
299 } 307 }
300 LOG_DEBUG ("Child hasn't died. Resuming to monitor its status\n"); 308 LOG_DEBUG ("Child hasn't died. Resuming to monitor its status\n");