From 406912b295bb20e67624e7afb6aafa7924350964 Mon Sep 17 00:00:00 2001 From: Nigel Kukard <nkukard@lbsd.net> Date: Mon, 11 Nov 2013 05:49:34 +0000 Subject: [PATCH] Fixed typo & added missing signal handler --- opentrafficshaper/plugins/tcstats/tcstats.pm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/opentrafficshaper/plugins/tcstats/tcstats.pm b/opentrafficshaper/plugins/tcstats/tcstats.pm index f701a24..b47e001 100644 --- a/opentrafficshaper/plugins/tcstats/tcstats.pm +++ b/opentrafficshaper/plugins/tcstats/tcstats.pm @@ -308,7 +308,7 @@ sub task_child_close # Reap the dead child -sub task_handle_sigchld +sub task_handle_SIGCHLD { my ($kernel,$heap,$pid,$status) = @_[KERNEL,HEAP,ARG1,ARG2]; my $task = $heap->{task_by_pid}->{$pid}; @@ -326,5 +326,22 @@ sub task_handle_sigchld } +# Handle SIGINT +sub task_handle_SIGINT +{ + my ($kernel,$heap,$signal_name) = @_[KERNEL,HEAP,ARG0]; + + # Shutdown stdin on all children, this will terminate /sbin/tc + foreach my $task_id (keys %{$heap->{'task_by_wid'}}) { + my $task = $heap->{'task_by_wid'}{$task_id}; +# $kernel->sig_child($task->PID, "asig_child"); +# $task->kill("INT"); #NK: doesn't work + $kernel->post($task,"shutdown_stdin"); #NK: doesn't work + } + + $logger->log(LOG_WARN,"[TCSTATS] Killed children processes"); +} + + 1; # vim: ts=4 -- GitLab