Author: vetinari
Date: Tue Oct  9 05:00:43 2007
New Revision: 809

Modified:
   trunk/Changes
   trunk/lib/Qpsmtpd/Connection.pm
   trunk/lib/Qpsmtpd/PollServer.pm
   trunk/lib/Qpsmtpd/SMTP.pm
   trunk/lib/Qpsmtpd/TcpServer/Prefork.pm
   trunk/lib/Qpsmtpd/Transaction.pm
   trunk/plugins/logging/connection_id
   trunk/plugins/logging/transaction_id
   trunk/qpsmtpd-forkserver

Log:
remove the connection / transaction id feature for 0.42 release 
 - add back in after 0.42 is out? if yes: start implementing in -prefork 


Modified: trunk/Changes
==============================================================================
--- trunk/Changes       (original)
+++ trunk/Changes       Tue Oct  9 05:00:43 2007
@@ -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

Modified: trunk/lib/Qpsmtpd/Connection.pm
==============================================================================
--- trunk/lib/Qpsmtpd/Connection.pm     (original)
+++ trunk/lib/Qpsmtpd/Connection.pm     Tue Oct  9 05:00:43 2007
@@ -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();

Modified: trunk/lib/Qpsmtpd/PollServer.pm
==============================================================================
--- trunk/lib/Qpsmtpd/PollServer.pm     (original)
+++ trunk/lib/Qpsmtpd/PollServer.pm     Tue Oct  9 05:00:43 2007
@@ -24,13 +24,10 @@
     _commands
     _config_cache
     _connection
-    _connection_count
     _continuation
     _extras
-    _id
     _test_mode
     _transaction
-    _transaction_count
 );
 use Qpsmtpd::Constants;
 use Qpsmtpd::Address;

Modified: trunk/lib/Qpsmtpd/SMTP.pm
==============================================================================
--- trunk/lib/Qpsmtpd/SMTP.pm   (original)
+++ trunk/lib/Qpsmtpd/SMTP.pm   Tue Oct  9 05:00:43 2007
@@ -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,26 +134,14 @@
 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 {

Modified: trunk/lib/Qpsmtpd/TcpServer/Prefork.pm
==============================================================================
--- trunk/lib/Qpsmtpd/TcpServer/Prefork.pm      (original)
+++ trunk/lib/Qpsmtpd/TcpServer/Prefork.pm      Tue Oct  9 05:00:43 2007
@@ -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(@_);
 }

Modified: trunk/lib/Qpsmtpd/Transaction.pm
==============================================================================
--- trunk/lib/Qpsmtpd/Transaction.pm    (original)
+++ trunk/lib/Qpsmtpd/Transaction.pm    Tue Oct  9 05:00:43 2007
@@ -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;

Modified: trunk/plugins/logging/connection_id
==============================================================================
--- trunk/plugins/logging/connection_id (original)
+++ trunk/plugins/logging/connection_id Tue Oct  9 05:00:43 2007
@@ -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+$/) {

Modified: trunk/plugins/logging/transaction_id
==============================================================================
--- trunk/plugins/logging/transaction_id        (original)
+++ trunk/plugins/logging/transaction_id        Tue Oct  9 05:00:43 2007
@@ -6,6 +6,7 @@
 
 sub register {
   my ($self, $qp, $loglevel) = @_;
+  die "The transaction ID feature is currently unsupported";
 
   $self->{_level} = LOGWARN;
   if ( defined($loglevel) ) {

Modified: trunk/qpsmtpd-forkserver
==============================================================================
--- trunk/qpsmtpd-forkserver    (original)
+++ trunk/qpsmtpd-forkserver    Tue Oct  9 05:00:43 2007
@@ -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,

Reply via email to