about summary refs log tree commit homepage
path: root/lib/PublicInbox/GitHTTPBackend.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-12-25 07:33:02 +0000
committerEric Wong <e@80x24.org>2016-12-25 10:30:19 +0000
commitf773704937f088c2ef6d5be1038e541284cf5372 (patch)
tree032487f0150490dad1b7d4159f57098b7e090b7d /lib/PublicInbox/GitHTTPBackend.pm
parent292ca34140489da2c3458e1d45da5a9ae4af540d (diff)
downloadpublic-inbox-f773704937f088c2ef6d5be1038e541284cf5372.tar.gz
Fewer returns improves readability and the diffstat agrees.
Diffstat (limited to 'lib/PublicInbox/GitHTTPBackend.pm')
-rw-r--r--lib/PublicInbox/GitHTTPBackend.pm18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 4ad3fd1e..1fa5e30e 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -225,7 +225,6 @@ sub serve_smart {
         };
         my $res;
         my $async = $env->{'pi-httpd.async'}; # XXX unstable API
-        my $io = $env->{'psgix.io'};
         my $cb = sub {
                 my $r = $rd_hdr->() or return;
                 $rd_hdr = undef;
@@ -236,17 +235,16 @@ sub serve_smart {
                                 $rpipe->close;
                                 $end->();
                         }
-                        return $res->($r);
-                }
-                if ($async) {
+                        $res->($r);
+                } elsif ($async) {
                         $fh = $res->($r);
-                        return $async->async_pass($io, $fh, \$buf);
+                        $async->async_pass($env->{'psgix.io'}, $fh, \$buf);
+                } else { # for synchronous PSGI servers
+                        require PublicInbox::GetlineBody;
+                        $r->[2] = PublicInbox::GetlineBody->new($rpipe, $end,
+                                                                $buf);
+                        $res->($r);
                 }
-
-                # for synchronous PSGI servers
-                require PublicInbox::GetlineBody;
-                $r->[2] = PublicInbox::GetlineBody->new($rpipe, $end, $buf);
-                $res->($r);
         };
         sub {
                 ($res) = @_;