]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/HTTP.pm
inbox: cleanup and consolidate object weakening
[public-inbox.git] / lib / PublicInbox / HTTP.pm
index c141fc896d0538875ca5a76c26c413ec910c4652..abf648f923179be7e6de904f7899f7ad2a003391 100644 (file)
@@ -25,15 +25,6 @@ use constant {
        CHUNK_MAX_HDR => 256,
 };
 
-# FIXME: duplicated code with NNTP.pm, layering violation
-my $WEAKEN = {}; # string(inbox) -> inbox
-my $weakt;
-sub weaken_task () {
-       $weakt = undef;
-       $_->weaken_all for values %$WEAKEN;
-       $WEAKEN = {};
-}
-
 my $pipelineq = [];
 my $pipet;
 sub process_pipelineq () {
@@ -223,7 +214,10 @@ sub chunked_wcb ($) {
                return if $_[0] eq '';
                more($self, sprintf("%x\r\n", bytes::length($_[0])));
                more($self, $_[0]);
-               $self->write("\r\n");
+
+               # use $self->write("\n\n") if you care about real-time
+               # streaming responses, public-inbox WWW does not.
+               more($self, "\r\n");
        }
 }
 
@@ -249,13 +243,6 @@ sub response_done ($$) {
        $self->{env} = undef;
        $self->write("0\r\n\r\n") if $alive == 2;
        $self->write(sub { $alive ? next_request($self) : $self->close });
-
-       # FIXME: layering violation
-       if (my $obj = $env->{'pi-httpd.inbox'}) {
-               # grace period for reaping resources
-               $WEAKEN->{"$obj"} = $obj;
-               PublicInbox::EvCleanup::later(*weaken_task);
-       }
 }
 
 sub getline_response {