Don't set an alarm if in connect mode.
Make fault() not return anything otherwise we get a "1" output in the stream git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@426 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
56451a722f
commit
42e49d493a
@ -89,6 +89,12 @@ sub respond {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub fault {
|
||||||
|
my $self = shift;
|
||||||
|
$self->SUPER::fault(@_);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sub process_line {
|
sub process_line {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $line = shift || return;
|
my $line = shift || return;
|
||||||
@ -97,14 +103,19 @@ sub process_line {
|
|||||||
my ($pkg, $file, $line) = caller();
|
my ($pkg, $file, $line) = caller();
|
||||||
die "ALARM: ($self->{mode}) $pkg, $file, $line";
|
die "ALARM: ($self->{mode}) $pkg, $file, $line";
|
||||||
};
|
};
|
||||||
my $prev = alarm(2); # must process a command in < 2 seconds
|
if( $self->{mode} eq 'connect' ) {
|
||||||
eval { $self->_process_line($line) };
|
eval { $self->_process_line($line) }
|
||||||
alarm($prev);
|
}
|
||||||
if ($@) {
|
else {
|
||||||
print STDERR "Error: $@\n";
|
my $prev = alarm(2); # must process a command in < 2 seconds
|
||||||
return $self->fault("command failed unexpectedly") if $self->{mode} eq 'cmd';
|
eval { $self->_process_line($line) };
|
||||||
return $self->fault("error processing data lines") if $self->{mode} eq 'data';
|
alarm($prev);
|
||||||
return $self->fault("unknown error");
|
if ($@) {
|
||||||
|
print STDERR "Error: $@\n";
|
||||||
|
return $self->fault("command failed unexpectedly") if $self->{mode} eq 'cmd';
|
||||||
|
return $self->fault("error processing data lines") if $self->{mode} eq 'data';
|
||||||
|
return $self->fault("unknown error");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -114,13 +125,12 @@ sub _process_line {
|
|||||||
my $line = shift;
|
my $line = shift;
|
||||||
|
|
||||||
if ($self->{mode} eq 'connect') {
|
if ($self->{mode} eq 'connect') {
|
||||||
warn("Connection incoming\n");
|
$self->{mode} = 'cmd';
|
||||||
my $rc = $self->start_conversation;
|
my $rc = $self->start_conversation;
|
||||||
if ($rc != DONE) {
|
if ($rc != DONE) {
|
||||||
$self->close;
|
$self->close;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$self->{mode} = 'cmd';
|
|
||||||
}
|
}
|
||||||
elsif ($self->{mode} eq 'cmd') {
|
elsif ($self->{mode} eq 'cmd') {
|
||||||
$line =~ s/\r?\n//;
|
$line =~ s/\r?\n//;
|
||||||
|
Loading…
Reference in New Issue
Block a user