Make sockfilter kill messages look alike server ones

This commit is contained in:
Yang Tse 2010-01-12 14:01:44 +00:00
Родитель 3fd67b5f36
Коммит 82f5ffff8f
1 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -25,7 +25,7 @@ use strict;
use warnings; use warnings;
use serverhelp qw( use serverhelp qw(
servername_str servername_id
mainsockf_pidfilename mainsockf_pidfilename
datasockf_pidfilename datasockf_pidfilename
); );
@ -178,19 +178,19 @@ sub killpid {
# #
sub killsockfilters { sub killsockfilters {
my ($proto, $ipvnum, $idnum, $verbose) = @_; my ($proto, $ipvnum, $idnum, $verbose) = @_;
my $srvrname; my $server;
my $pidfile; my $pidfile;
my $pid; my $pid;
return if($proto !~ /^(ftp|imap|pop3|smtp)$/); return if($proto !~ /^(ftp|imap|pop3|smtp)$/);
$srvrname = servername_str($proto, $ipvnum, $idnum) if($verbose); $server = servername_id($proto, $ipvnum, $idnum) if($verbose);
$pidfile = "./". mainsockf_pidfilename($proto, $ipvnum, $idnum); $pidfile = mainsockf_pidfilename($proto, $ipvnum, $idnum);
$pid = processexists($pidfile); $pid = processexists($pidfile);
if($pid > 0) { if($pid > 0) {
printf("* kill pid for %s => %d\n", "${srvrname}-CTRL", $pid) printf("* kill pid for %s-%s => %d\n", $server,
if($verbose); ($proto eq 'ftp')?'ctrl':'filt', $pid) if($verbose);
kill("KILL", $pid); kill("KILL", $pid);
waitpid($pid, 0); waitpid($pid, 0);
} }
@ -198,11 +198,11 @@ sub killsockfilters {
return if($proto ne 'ftp'); return if($proto ne 'ftp');
$pidfile = "./". datasockf_pidfilename($proto, $ipvnum, $idnum); $pidfile = datasockf_pidfilename($proto, $ipvnum, $idnum);
$pid = processexists($pidfile); $pid = processexists($pidfile);
if($pid > 0) { if($pid > 0) {
printf("* kill pid for %s => %d\n", "${srvrname}-DATA", $pid) printf("* kill pid for %s-data => %d\n", $server,
if($verbose); $pid) if($verbose);
kill("KILL", $pid); kill("KILL", $pid);
waitpid($pid, 0); waitpid($pid, 0);
} }