Update id generator again
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@777 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
3a85914315
commit
bf5d011d85
@ -135,7 +135,7 @@ sub transaction {
|
|||||||
sub reset_transaction {
|
sub reset_transaction {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->run_hooks("reset_transaction") if $self->{_transaction};
|
$self->run_hooks("reset_transaction") if $self->{_transaction};
|
||||||
return $self->{_transaction} = Qpsmtpd::Transaction->new(connection => $self->connection);
|
return $self->{_transaction} = Qpsmtpd::Transaction->new();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ use strict;
|
|||||||
use Qpsmtpd::Utils;
|
use Qpsmtpd::Utils;
|
||||||
use Qpsmtpd::Constants;
|
use Qpsmtpd::Constants;
|
||||||
use Socket qw(inet_aton);
|
use Socket qw(inet_aton);
|
||||||
use Time::HiRes qw(time);
|
use Time::HiRes qw(gettimeofday);
|
||||||
|
|
||||||
use IO::File qw(O_RDWR O_CREAT);
|
use IO::File qw(O_RDWR O_CREAT);
|
||||||
|
|
||||||
@ -17,10 +17,11 @@ sub start {
|
|||||||
my %args = @_;
|
my %args = @_;
|
||||||
|
|
||||||
# generate id
|
# generate id
|
||||||
my $conn = $args{connection};
|
# use gettimeofday for microsec precision
|
||||||
my $ip = $conn->remote_port || "0";
|
my ($start, $mstart) = gettimeofday();
|
||||||
my $start = time;
|
# add in rand() in case gettimeofday clock is slow (e.g. bsd?)
|
||||||
my $id = "$start.$$.$ip";
|
# add in $$ in case srand is set per process
|
||||||
|
my $id = sprintf("%d.%06d.%d.%d", $start, $mstart, rand(10000), $$);
|
||||||
|
|
||||||
my $self = { _rcpt => [], started => $start, _id => $id };
|
my $self = { _rcpt => [], started => $start, _id => $id };
|
||||||
bless ($self, $class);
|
bless ($self, $class);
|
||||||
|
Loading…
Reference in New Issue
Block a user