# HG changeset patch # User jbe # Date 1496597011 -7200 # Node ID 694446c1316b4de5c15a6a90ffb5e18b1f24cd3c # Parent d6de7502df3189bad5746742ab28f67c685f3cb9 Use SIGTERM to terminate child processes gracefully diff -r d6de7502df31 -r 694446c1316b moonbridge.c --- a/moonbridge.c Sun Jun 04 18:30:13 2017 +0200 +++ b/moonbridge.c Sun Jun 04 19:23:31 2017 +0200 @@ -323,7 +323,6 @@ switch (sig) { case SIGHUP: case SIGINT: - case SIGTERM: kill(moonbr_masterpid, sig); } } @@ -337,7 +336,6 @@ signal(SIGINT, moonbr_signal); signal(SIGTERM, moonbr_signal); signal(SIGCHLD, moonbr_signal); - /* signal(SIGUSR1, moonbr_signal); */ /* might be used to terminate children gracefully */ } @@ -1145,16 +1143,13 @@ } } moonbr_poll_shutdown(); /* avoids loops due to error condition when polling closed listeners */ - /* sending SIGUSR1 to children might be used to terminate children gracefully */ - /* { pid_t pgrp = getpgrp(); - moonbr_log(LOG_INFO, "Sending SIGUSR1 to all processes in group %i", (int)pgrp); - if (killpg(pgrp, SIGUSR1)) { - moonbr_log(LOG_WARNING, "Error while sending SIGUSR1 to own process group: %s", strerror(errno)); + moonbr_log(LOG_INFO, "Sending SIGTERM to all processes in group %i", (int)pgrp); + if (killpg(pgrp, SIGTERM)) { + moonbr_log(LOG_WARNING, "Error while sending SIGTERM to own process group: %s", strerror(errno)); } } - */ }