From: Eric Wong Date: Sun, 19 Jun 2016 06:32:41 +0000 (+0000) Subject: http: avoid recursion when hitting write count limit X-Git-Tag: v1.0.0~406 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=271301a493f5418ddf5065d412811fde0a68e984;p=public-inbox.git http: avoid recursion when hitting write count limit Use the EvCleanup::asap handler to reschedule our writes after yielding to other clients. --- diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index 6df1c3fc..e0ed2d15 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -271,9 +271,12 @@ sub getline_response { while ($forward && defined(my $buf = $forward->getline)) { $write->($buf); last if $self->{closed}; - if ((--$n) <= 0 || $self->{write_buf_size}) { + if ($self->{write_buf_size}) { $self->write($self->{pull}); return; + } elsif ((--$n) <= 0) { + PublicInbox::EvCleanup::asap($self->{pull}); + return; } } $self->{forward} = $self->{pull} = undef;