From aea0a8d8bf9bf26898c811bf28f023d968c39de3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 14 Sep 2019 09:35:39 +0000 Subject: httpd/async: improve naming and comments Rename the {cleanup} field to {end}, since it's similar to END {} and is consistent with the variable in Qspawn.pm And document how certain subs get called, since we have many subs named "new" and "close". --- lib/PublicInbox/Qspawn.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/Qspawn.pm') diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm index 76e48e81..294bf0a4 100644 --- a/lib/PublicInbox/Qspawn.pm +++ b/lib/PublicInbox/Qspawn.pm @@ -230,6 +230,7 @@ sub psgi_return { my $buf = ''; my $rd_hdr = sub { + # typically used for reading CGI headers # we must loop until EAGAIN for EPOLLET in HTTPD/Async.pm # We also need to check EINTR for generic PSGI servers. my $ret; @@ -250,7 +251,7 @@ sub psgi_return { my $cb = sub { my $r = $rd_hdr->() or return; - $rd_hdr = undef; + $rd_hdr = undef; # done reading headers my $filter = delete $env->{'qspawn.filter'}; if (scalar(@$r) == 3) { # error if ($async) { @@ -261,6 +262,7 @@ sub psgi_return { } $wcb->($r); } elsif ($async) { + # done reading headers, handoff to read body $fh = $wcb->($r); # scalar @$r == 2 $fh = filter_fh($fh, $filter) if $filter; $async->async_pass($env->{'psgix.io'}, $fh, \$buf); -- cgit v1.2.3-24-ge0c7