about summary refs log tree commit homepage
path: root/lib/PublicInbox/Qspawn.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-09-14 09:35:39 +0000
committerEric Wong <e@80x24.org>2019-09-14 09:36:07 +0000
commitaea0a8d8bf9bf26898c811bf28f023d968c39de3 (patch)
tree737dbf6d966645d52872ae7a4d6af53d7e19bcc7 /lib/PublicInbox/Qspawn.pm
parent500a3dad334601d928e20dd9d764fb117f65103d (diff)
downloadpublic-inbox-aea0a8d8bf9bf26898c811bf28f023d968c39de3.tar.gz
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".
Diffstat (limited to 'lib/PublicInbox/Qspawn.pm')
-rw-r--r--lib/PublicInbox/Qspawn.pm4
1 files changed, 3 insertions, 1 deletions
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);