From bfd609fb3244ab1687f8fc257a74234ab56467e5 Mon Sep 17 00:00:00 2001 From: Matt Sergeant Date: Fri, 19 Nov 2004 08:44:24 +0000 Subject: [PATCH] Fix timeout config warnings. Fix alarm not being reset at end of while loop git-svn-id: https://svn.perl.org/qpsmtpd/trunk@342 958fd67b-6ff1-0310-b445-bb7760255be9 --- lib/Qpsmtpd/SMTP.pm | 8 +++----- lib/Qpsmtpd/TcpServer.pm | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) 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 {