On Fri, 31 Aug 2007 13:58:26 +0200 Stefan Priebe <[EMAIL PROTECTED]> wrote: > To 1.) i'm not shure but it works perfectly with only deleting the > _auth. The main question is - what gives us MORE performance (delete the > values or create a new instance). The clean solution is, to create a new > instance - that's right. Ok, here we go... ;-)
Attached are two diffs: the first (prefork-newinst.diff) does it right. I'm not sure if everything works as expected with the second one (prefork-cloneinst.diff), but from the first tests, everything looks ok. Oh, the second one is a bit faster .) Hanno
Index: qpsmtpd-prefork =================================================================== --- qpsmtpd-prefork (revision 783) +++ qpsmtpd-prefork (working copy) @@ -222,7 +222,7 @@ }; # setup qpsmtpd_instance - $qpsmtpd = qpmsptd_instance(); + $qpsmtpd = qpsmtpd_instance(); # child reaper $SIG{CHLD} = \&reaper; @@ -367,6 +367,9 @@ or die "failed to create new object - $!"; # wait here until client connects info("connect from: " . $client->peerhost . ":" . $client->peerport); + + # clear a previously running instance by creating a new: + $qpsmtpd = qpsmtpd_instance(); # set STDIN/STDOUT and autoflush POSIX::dup2(fileno($client), 0) @@ -410,7 +413,7 @@ # qpsmtpd_instance: setup qpsmtpd instance # arg0: void # ret0: ref to qpsmtpd_instance -sub qpmsptd_instance { +sub qpsmtpd_instance { my $qpsmtpd = Qpsmtpd::TcpServer::Prefork->new(); $qpsmtpd->load_plugins; $qpsmtpd->spool_dir;
Index: qpsmtpd-prefork =================================================================== --- qpsmtpd-prefork (revision 783) +++ qpsmtpd-prefork (working copy) @@ -35,7 +35,7 @@ my $VERSION = "1.0"; # qpsmtpd instance -my $qpsmtpd; +my ($qpsmtpd, $qpsmtpd_base); # cmd's needed by IPC my $ipcrm = '/usr/bin/ipcrm'; @@ -222,7 +222,7 @@ }; # setup qpsmtpd_instance - $qpsmtpd = qpmsptd_instance(); + $qpsmtpd = $qpsmtpd_base = qpsmtpd_instance(); # child reaper $SIG{CHLD} = \&reaper; @@ -367,6 +367,9 @@ or die "failed to create new object - $!"; # wait here until client connects info("connect from: " . $client->peerhost . ":" . $client->peerport); + + # clear a previously running instance by cloning the base: + $qpsmtpd = $qpsmtpd_base; # set STDIN/STDOUT and autoflush POSIX::dup2(fileno($client), 0) @@ -410,7 +413,7 @@ # qpsmtpd_instance: setup qpsmtpd instance # arg0: void # ret0: ref to qpsmtpd_instance -sub qpmsptd_instance { +sub qpsmtpd_instance { my $qpsmtpd = Qpsmtpd::TcpServer::Prefork->new(); $qpsmtpd->load_plugins; $qpsmtpd->spool_dir;