X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FHTTP.pm;h=5844ef440f1e8dd324ce6b67401de7c99e696c8e;hb=c86657e655936d59cab8a88ef1fc1e986c5fb3f0;hp=8281746538e2df420a7003a8fc62cdd2dab159a9;hpb=94096cab6cd5e00c8a36a4a2667bdb9acf43d01f;p=public-inbox.git diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index 82817465..5844ef44 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -488,6 +488,13 @@ sub busy () { ($self->{rbuf} || exists($self->{env}) || $self->{wbuf}); } +# runs $cb on the next iteration of the event loop at earliest +sub next_step { + my ($self, $cb) = @_; + return unless exists $self->{sock}; + $self->requeue if 1 == push(@{$self->{wbuf}}, $cb); +} + # Chunked and Identity packages are used for writing responses. # They may be exposed to the PSGI application when the PSGI app # returns a CODE ref for "push"-based responses