diff --git a/lib/Qpsmtpd/SMTP.pm b/lib/Qpsmtpd/SMTP.pm index d0d6180..51804e8 100644 --- a/lib/Qpsmtpd/SMTP.pm +++ b/lib/Qpsmtpd/SMTP.pm @@ -429,8 +429,8 @@ sub data { my $header = Mail::Header->new(Modify => 0, MailFrom => "COERCE"); - - while (defined($_ = $self->getline)) { + my $timeout = $self->config('timeout'); + while (defined($_ = $self->getline($timeout))) { $complete++, last if $_ eq ".\r\n"; $i++; @@ -524,10 +524,8 @@ sub data { } sub getline { - my $self = shift; + my ($self, $timeout) = @_; - my $timeout = $self->config('timeout'); - alarm $timeout; my $line = ; # default implementation alarm 0; diff --git a/lib/Qpsmtpd/TcpServer.pm b/lib/Qpsmtpd/TcpServer.pm index f67e13f..054ca8a 100644 --- a/lib/Qpsmtpd/TcpServer.pm +++ b/lib/Qpsmtpd/TcpServer.pm @@ -62,6 +62,7 @@ sub read_input { or $self->respond(502, "command unrecognized: '$_'"); alarm $timeout; } + alarm(0); } sub respond {