about summary refs log tree commit homepage
path: root/lib/PublicInbox/Qspawn.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-08-22 02:33:43 +0000
committerEric Wong <e@80x24.org>2022-08-23 04:19:00 +0000
commit3ac9f1f873bf7d7b9075cf492733a3d79b32e22a (patch)
treeb12818af643eb7ddf5a01ac7ec4f5252448fcfcf /lib/PublicInbox/Qspawn.pm
parenta66872a124b3cde936a0d31b8d9f5a8fddee7573 (diff)
downloadpublic-inbox-3ac9f1f873bf7d7b9075cf492733a3d79b32e22a.tar.gz
This makes things easier-to-follow in a minimally-typed language.
Diffstat (limited to 'lib/PublicInbox/Qspawn.pm')
-rw-r--r--lib/PublicInbox/Qspawn.pm13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm
index 53d0ad55..79db9e76 100644
--- a/lib/PublicInbox/Qspawn.pm
+++ b/lib/PublicInbox/Qspawn.pm
@@ -132,7 +132,7 @@ sub start ($$$) {
 
 sub psgi_qx_init_cb {
         my ($self) = @_;
-        my $async = delete $self->{async};
+        my $async = delete $self->{async}; # PublicInbox::HTTPD::Async
         my ($r, $buf);
         my $qx_fh = $self->{qx_fh};
 reread:
@@ -227,11 +227,10 @@ sub psgi_return_init_cb {
                 PublicInbox::GzipFilter::qsp_maybe($r->[1], $env);
 
         my $wcb = delete $env->{'qspawn.wcb'};
-        my $async = delete $self->{async};
+        my $async = delete $self->{async}; # PublicInbox::HTTPD::Async
         if (scalar(@$r) == 3) { # error
-                if ($async) {
-                        # calls rpipe->close && ->event_step
-                        $async->close;
+                if ($async) { # calls rpipe->close && ->event_step
+                        $async->close; # PublicInbox::HTTPD::Async::close
                 } else {
                         $self->{rpipe}->close;
                         event_step($self);
@@ -255,9 +254,9 @@ sub psgi_return_init_cb {
 
 sub psgi_return_start { # may run later, much later...
         my ($self) = @_;
-        if (my $async = $self->{psgi_env}->{'pi-httpd.async'}) {
+        if (my $cb = $self->{psgi_env}->{'pi-httpd.async'}) {
                 # PublicInbox::HTTPD::Async->new(rpipe, $cb, $cb_arg, $end_obj)
-                $self->{async} = $async->($self->{rpipe},
+                $self->{async} = $cb->($self->{rpipe},
                                         \&psgi_return_init_cb, $self, $self);
         } else { # generic PSGI
                 psgi_return_init_cb($self) while $self->{parse_hdr};