diff --git a/opentrafficshaper/plugins/tcstats/tcstats.pm b/opentrafficshaper/plugins/tcstats/tcstats.pm index f701a2485ebf1c8e60ede69147a7a921ecbb7fbc..b47e0014d22d2c20318a99d933dc656f5b687d6d 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