about summary refs log tree commit homepage
path: root/lib/PublicInbox/HTTP.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-06-24 02:52:29 +0000
committerEric Wong <e@80x24.org>2019-06-24 05:26:26 +0000
commit8e1c3155da4edc082e8e3d8b30351f0c861757a7 (patch)
tree255a1c9ddb68b8c2ece212adc4ad1df677bec4c0 /lib/PublicInbox/HTTP.pm
parent2600289573c569fea65a1da817497414175bae55 (diff)
downloadpublic-inbox-8e1c3155da4edc082e8e3d8b30351f0c861757a7.tar.gz
We can reduce the amount of short-lived anonymous subs we
create by passing $self to code references.
Diffstat (limited to 'lib/PublicInbox/HTTP.pm')
-rw-r--r--lib/PublicInbox/HTTP.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm
index c81aeacd..e132c610 100644
--- a/lib/PublicInbox/HTTP.pm
+++ b/lib/PublicInbox/HTTP.pm
@@ -247,7 +247,7 @@ sub response_done_cb ($$) {
         sub {
                 my $env = delete $self->{env};
                 $self->write(\"0\r\n\r\n") if $alive == 2;
-                $self->write(sub{$alive ? next_request($self) : $self->close});
+                $self->write($alive ? \&next_request : \&close);
         }
 }
 
@@ -456,4 +456,11 @@ sub busy () {
         ($self->{rbuf} ne '' || $self->{env} || $self->{wbuf});
 }
 
+# fires after pending writes are complete:
+sub restart_pass ($) {
+        $_[0]->{forward}->restart_read; # see PublicInbox::HTTPD::Async
+}
+
+sub enqueue_restart_pass ($) { $_[0]->write(\&restart_pass) }
+
 1;