Fairness patch - prevent bad pipelining clients from hogging the event loop
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@852 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
41d00e8b91
commit
f84ba8eb92
@ -113,7 +113,7 @@ sub process_read_buf {
|
||||
$self->{line} .= $$bref;
|
||||
return if $self->{pause_count} || $self->{closed};
|
||||
|
||||
while ($self->{line} =~ s/^(.*?\n)//) {
|
||||
if ($self->{line} =~ s/^(.*?\n)//) {
|
||||
my $line = $1;
|
||||
$self->{alive_time} = time;
|
||||
my $resp = $self->process_line($line);
|
||||
@ -121,6 +121,12 @@ sub process_read_buf {
|
||||
$self->write($resp) if $resp;
|
||||
# $self->watch_read(0) if $self->{pause_count};
|
||||
return if $self->{pause_count} || $self->{closed};
|
||||
# read more in a timer, to give other clients a look in
|
||||
$self->AddTimer(0, sub {
|
||||
if (length($self->{line}) && !$self->paused) {
|
||||
$self->process_read_buf(\""); # " for bad syntax highlighters
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user