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
This commit is contained in:
Matt Sergeant 2004-11-19 08:44:24 +00:00
parent 4c44510191
commit bfd609fb32
2 changed files with 4 additions and 5 deletions

View File

@ -429,8 +429,8 @@ sub data {
my $header = Mail::Header->new(Modify => 0, MailFrom => "COERCE"); my $header = Mail::Header->new(Modify => 0, MailFrom => "COERCE");
my $timeout = $self->config('timeout');
while (defined($_ = $self->getline)) { while (defined($_ = $self->getline($timeout))) {
$complete++, last if $_ eq ".\r\n"; $complete++, last if $_ eq ".\r\n";
$i++; $i++;
@ -524,10 +524,8 @@ sub data {
} }
sub getline { sub getline {
my $self = shift; my ($self, $timeout) = @_;
my $timeout = $self->config('timeout');
alarm $timeout; alarm $timeout;
my $line = <STDIN>; # default implementation my $line = <STDIN>; # default implementation
alarm 0; alarm 0;

View File

@ -62,6 +62,7 @@ sub read_input {
or $self->respond(502, "command unrecognized: '$_'"); or $self->respond(502, "command unrecognized: '$_'");
alarm $timeout; alarm $timeout;
} }
alarm(0);
} }
sub respond { sub respond {