prefork: use new instance instead of cloning
Create a new instance instead of cloning^copying the base instance, see http://www.nntp.perl.org/group/perl.qpsmtpd/2008/07/msg8134.html ff.
This commit is contained in:
parent
33d8825ecf
commit
0b0e4e911a
@ -49,7 +49,7 @@ foreach my $sig_name ( split( /\s/, $Config{sig_name} ) )
|
|||||||
my $VERSION = "1.0";
|
my $VERSION = "1.0";
|
||||||
|
|
||||||
# qpsmtpd instances
|
# qpsmtpd instances
|
||||||
my ($qpsmtpd, $qpsmtpd_base);
|
my ($qpsmtpd);
|
||||||
|
|
||||||
# cmd's needed by IPC
|
# cmd's needed by IPC
|
||||||
my $ipcrm = '/usr/bin/ipcrm';
|
my $ipcrm = '/usr/bin/ipcrm';
|
||||||
@ -276,15 +276,14 @@ sub run {
|
|||||||
# Hup handler
|
# Hup handler
|
||||||
$SIG{HUP} = sub {
|
$SIG{HUP} = sub {
|
||||||
# reload qpmstpd plugins
|
# reload qpmstpd plugins
|
||||||
$qpsmtpd = $qpsmtpd_base = qpsmtpd_instance('restart' => 1); # reload plugins...
|
$qpsmtpd = qpsmtpd_instance('restart' => 1); # reload plugins...
|
||||||
$qpsmtpd->load_plugins;
|
$qpsmtpd->load_plugins;
|
||||||
kill 'HUP' => keys %children;
|
kill 'HUP' => keys %children;
|
||||||
info("reload daemon requested");
|
info("reload daemon requested");
|
||||||
};
|
};
|
||||||
|
|
||||||
# setup qpsmtpd_instance(s), _base is for resetting to a known state
|
# setup qpsmtpd_instance
|
||||||
# after each connection
|
$qpsmtpd = qpsmtpd_instance();
|
||||||
$qpsmtpd = $qpsmtpd_base = qpsmtpd_instance();
|
|
||||||
|
|
||||||
if ($detach) {
|
if ($detach) {
|
||||||
open STDIN, '/dev/null' or die "/dev/null: $!";
|
open STDIN, '/dev/null' or die "/dev/null: $!";
|
||||||
@ -462,8 +461,8 @@ sub new_child {
|
|||||||
"failed to create new object - $!"; # wait here until client connects
|
"failed to create new object - $!"; # wait here until client connects
|
||||||
info("connect from: " . $client->peerhost . ":" . $client->peerport);
|
info("connect from: " . $client->peerhost . ":" . $client->peerport);
|
||||||
|
|
||||||
# clear a previously running instance by cloning the base:
|
# clear a previously running instance by creating a new instance
|
||||||
$qpsmtpd = $qpsmtpd_base;
|
$qpsmtpd = qpsmtpd_instance();
|
||||||
|
|
||||||
# set STDIN/STDOUT and autoflush
|
# set STDIN/STDOUT and autoflush
|
||||||
# ... no longer use POSIX::dup2: it failes after a few
|
# ... no longer use POSIX::dup2: it failes after a few
|
||||||
|
Loading…
Reference in New Issue
Block a user