remove the connection / transaction id feature for 0.42 release

- add back in after 0.42 is out? if yes: start implementing in -prefork 


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@809 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Hanno Hecker 2007-10-09 12:00:43 +00:00
parent 7fa3918803
commit 7d4605fdbc
9 changed files with 6 additions and 59 deletions

View File

@ -2,9 +2,6 @@
New docs/plugins.pod documentation!
Connection and transaction objects now have an "id" method returning a
unique id (good for logging etc).
Add X-Spam-Level header in spamassassin plugin (idea from Werner Fleck)
prefork: support two or more parallel running instances (on different

View File

@ -36,18 +36,6 @@ sub start {
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();

View File

@ -24,13 +24,10 @@ use fields qw(
_commands
_config_cache
_connection
_connection_count
_continuation
_extras
_id
_test_mode
_transaction
_transaction_count
);
use Qpsmtpd::Constants;
use Qpsmtpd::Address;

View File

@ -19,8 +19,6 @@ use Mail::Header ();
#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 @@ sub new {
$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,26 +134,14 @@ sub transaction {
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};
}
sub reset_connection {
my $self = shift;
$self->connection->id($self->id . "." . ++$self->{_connection_count});
$self->{_transaction_count} = 0;
$self->reset_transaction;
return $self->{_connection} || ($self->{_connection} = Qpsmtpd::Connection->new());
}
sub helo {

View File

@ -11,7 +11,7 @@ sub start_connection {
my $self = shift;
#reset info
$self->reset_connection; #reset connection
$self->{_connection} = Qpsmtpd::Connection->new(); #reset connection
$self->reset_transaction;
$self->SUPER::start_connection(@_);
}

View File

@ -10,11 +10,6 @@ use Time::HiRes qw(gettimeofday);
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 @@ sub start {
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;

View File

@ -6,7 +6,7 @@
sub register {
my ($self, $qp, $loglevel) = @_;
die "The connection ID feature is currently unsupported";
$self->{_level} = LOGWARN;
if ( defined($loglevel) ) {
if ($loglevel =~ /^\d+$/) {

View File

@ -6,6 +6,7 @@
sub register {
my ($self, $qp, $loglevel) = @_;
die "The transaction ID feature is currently unsupported";
$self->{_level} = LOGWARN;
if ( defined($loglevel) ) {

View File

@ -239,7 +239,6 @@ while (1) {
# 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,