On Mon, 1 Oct 2007 20:56:12 +0200 Hanno Hecker <[EMAIL PROTECTED]> wrote:
> On Sun, 30 Sep 2007 23:28:42 -0700 > Ask Bjørn Hansen <[EMAIL PROTECTED]> wrote: > > Is this a regression from 0.40? If it is then we need to fix it > > before releasing 0.42 - if it happened in 0.40 too then we can fix it > > in 0.43. (I guess prefork was broken enough in 0.40 that it doesn't > > really matter either way?). > This does not happen in 0.40. I think it belongs to the transaction / > connection id stuff. We should fix it before 0.42, the known bugs from > 0.40 in prefork are fixed. The attached diff removes all of the transaction / connection id changes from trunk. I can't test with -async, because Matt's last change involved some changes that's not available on CPAN (Event::Lib 1.03 does not have the "dns" export), reverting to the old ParaDNS works. If it's ok, I'll submit to trunk, so we can release 0.42 Hanno
Index: qpsmtpd-forkserver =================================================================== --- qpsmtpd-forkserver (revision 807) +++ qpsmtpd-forkserver (working copy) @@ -239,7 +239,6 @@ # get local/remote hostname, port and ip address my ($port, $iaddr, $lport, $laddr, $nto_iaddr, $nto_laddr) = Qpsmtpd::TcpServer::lrpip($server, $client, $hisaddr); - $qpsmtpd->reset_connection; my ($rc, @msg) = $qpsmtpd->run_hooks("pre-connection", remote_ip => $nto_iaddr, remote_port => $port, Index: lib/Qpsmtpd/SMTP.pm =================================================================== --- lib/Qpsmtpd/SMTP.pm (revision 807) +++ lib/Qpsmtpd/SMTP.pm (working copy) @@ -19,8 +19,6 @@ #use Data::Dumper; use POSIX qw(strftime); use Net::DNS; -use Time::HiRes qw(gettimeofday); -use Sys::Hostname; # this is only good for forkserver # can't set these here, cause forkserver resets them @@ -42,17 +40,6 @@ $self; } -sub id { - my $self = shift; - unless ($self->{_id}) { - $self->{_id} = sprintf("%d.%06d.%s.%d", - gettimeofday, - unpack("H*", (gethostbyname(hostname))[4]), - $$); - } - return $self->{_id}; -} - sub command_counter { my $self = shift; $self->{_counter} || 0; @@ -147,28 +134,16 @@ sub reset_transaction { my $self = shift; $self->run_hooks("reset_transaction") if $self->{_transaction}; - return $self->{_transaction} = - Qpsmtpd::Transaction->new(id => $self->connection->id . "." . ++$self->{_transaction_count}); + return $self->{_transaction} = Qpsmtpd::Transaction->new(); } sub connection { my $self = shift; @_ and $self->{_connection} = shift; - unless ($self->{_connection}) { - $self->{_connection} = Qpsmtpd::Connection->new(); - $self->reset_connection; - } - return $self->{_connection}; + return $self->{_connection} || ($self->{_connection} = Qpsmtpd::Connection->new()); } -sub reset_connection { - my $self = shift; - $self->connection->id($self->id . "." . ++$self->{_connection_count}); - $self->{_transaction_count} = 0; - $self->reset_transaction; -} - sub helo { my ($self, $line) = @_; my ($rc, @msg) = $self->run_hooks('helo_parse'); Index: lib/Qpsmtpd/Transaction.pm =================================================================== --- lib/Qpsmtpd/Transaction.pm (revision 807) +++ lib/Qpsmtpd/Transaction.pm (working copy) @@ -10,11 +10,6 @@ use IO::File qw(O_RDWR O_CREAT); -my $SALT_HOST = crypt(hostname, chr(65+rand(57)).chr(65+rand(57))); -$SALT_HOST =~ tr/A-Za-z0-9//cd; - -my $SEQUENCE_ID = 1; - sub new { start(@_) } sub start { @@ -22,16 +17,11 @@ my $class = ref($proto) || $proto; my %args = @_; - my $self = { _rcpt => [], started => time, _id => $args{id} }; + my $self = { _rcpt => [], started => time, }; bless ($self, $class); return $self; } -sub id { - my $self = shift; - $self->{_id}; -} - sub add_recipient { my $self = shift; @_ and push @{$self->{_recipients}}, shift; Index: lib/Qpsmtpd/PollServer.pm =================================================================== --- lib/Qpsmtpd/PollServer.pm (revision 807) +++ lib/Qpsmtpd/PollServer.pm (working copy) @@ -26,13 +26,10 @@ _commands _config_cache _connection - _connection_count _continuation _extras - _id _test_mode _transaction - _transaction_count ); use Qpsmtpd::Constants; use Qpsmtpd::Address; Index: lib/Qpsmtpd/Connection.pm =================================================================== --- lib/Qpsmtpd/Connection.pm (revision 807) +++ lib/Qpsmtpd/Connection.pm (working copy) @@ -36,18 +36,6 @@ return $self; } -sub id { - my $self = shift; - $self->{_id} = shift if @_; - $self->{_id}; -} - -sub inc_id { - my $self = shift; - my ($qp_id, $count) = $self->{_id} =~ m/(.+)\.(\d+)/; - $self->{_id} = $qp_id . "." . ++$count; -} - sub clone { my $self = shift; my $new = $self->new(); Index: lib/Qpsmtpd/TcpServer/Prefork.pm =================================================================== --- lib/Qpsmtpd/TcpServer/Prefork.pm (revision 807) +++ lib/Qpsmtpd/TcpServer/Prefork.pm (working copy) @@ -11,7 +11,7 @@ my $self = shift; #reset info - $self->reset_connection; #reset connection + $self->{_connection} = Qpsmtpd::Connection->new(); #reset connection $self->reset_transaction; $self->SUPER::start_connection(@_); }