1 |
From 0b0e4e911a4af89ac0e524b90d89361f829c884c Mon Sep 17 00:00:00 2001 |
2 |
From: Hanno Hecker <vetinari@ankh-morp.org> |
3 |
Date: Sat, 28 Feb 2009 08:27:55 +0100 |
4 |
Subject: prefork: use new instance instead of cloning |
5 |
|
6 |
Create a new instance instead of cloning^copying the base instance, |
7 |
see http://www.nntp.perl.org/group/perl.qpsmtpd/2008/07/msg8134.html ff. |
8 |
--- |
9 |
qpsmtpd-prefork | 13 ++++++------- |
10 |
1 files changed, 6 insertions(+), 7 deletions(-) |
11 |
|
12 |
diff --git a/qpsmtpd-prefork b/qpsmtpd-prefork |
13 |
index 93a7120..c176886 100755 |
14 |
--- a/qpsmtpd-prefork |
15 |
+++ b/qpsmtpd-prefork |
16 |
@@ -49,7 +49,7 @@ foreach my $sig_name ( split( /\s/, $Config{sig_name} ) ) |
17 |
my $VERSION = "1.0"; |
18 |
|
19 |
# qpsmtpd instances |
20 |
-my ($qpsmtpd, $qpsmtpd_base); |
21 |
+my ($qpsmtpd); |
22 |
|
23 |
# cmd's needed by IPC |
24 |
my $ipcrm = '/usr/bin/ipcrm'; |
25 |
@@ -276,15 +276,14 @@ sub run { |
26 |
# Hup handler |
27 |
$SIG{HUP} = sub { |
28 |
# reload qpmstpd plugins |
29 |
- $qpsmtpd = $qpsmtpd_base = qpsmtpd_instance('restart' => 1); # reload plugins... |
30 |
+ $qpsmtpd = qpsmtpd_instance('restart' => 1); # reload plugins... |
31 |
$qpsmtpd->load_plugins; |
32 |
kill 'HUP' => keys %children; |
33 |
info("reload daemon requested"); |
34 |
}; |
35 |
|
36 |
- # setup qpsmtpd_instance(s), _base is for resetting to a known state |
37 |
- # after each connection |
38 |
- $qpsmtpd = $qpsmtpd_base = qpsmtpd_instance(); |
39 |
+ # setup qpsmtpd_instance |
40 |
+ $qpsmtpd = qpsmtpd_instance(); |
41 |
|
42 |
if ($detach) { |
43 |
open STDIN, '/dev/null' or die "/dev/null: $!"; |
44 |
@@ -462,8 +461,8 @@ sub new_child { |
45 |
"failed to create new object - $!"; # wait here until client connects |
46 |
info("connect from: " . $client->peerhost . ":" . $client->peerport); |
47 |
|
48 |
- # clear a previously running instance by cloning the base: |
49 |
- $qpsmtpd = $qpsmtpd_base; |
50 |
+ # clear a previously running instance by creating a new instance |
51 |
+ $qpsmtpd = qpsmtpd_instance(); |
52 |
|
53 |
# set STDIN/STDOUT and autoflush |
54 |
# ... no longer use POSIX::dup2: it failes after a few |
55 |
-- |
56 |
1.7.2.2 |
57 |
|