diff options
author | Eric Wong <e@80x24.org> | 2016-02-28 20:57:57 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-02-28 22:11:40 +0000 |
commit | aeaa38f620cf880a073b3a37463f0c577188df46 (patch) | |
tree | 16af51e676eb868199e1c0cd99309657d6f5970d /lib/PublicInbox/HTTP.pm | |
parent | 2ac2023fa416e31189708c355db8728abbd9ef2c (diff) | |
download | public-inbox-aeaa38f620cf880a073b3a37463f0c577188df46.tar.gz |
HTTP responses may be long-running or requests may be slow or pipelined. Ensure we don't kill them off prematurely.
Diffstat (limited to 'lib/PublicInbox/HTTP.pm')
-rw-r--r-- | lib/PublicInbox/HTTP.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index f1016d2f..928c0f22 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -103,7 +103,6 @@ sub app_dispatch ($) { my ($self) = @_; $self->watch_read(0); my $env = $self->{env}; - $self->{env} = undef; $env->{REMOTE_ADDR} = $self->peer_ip_string; # Danga::Socket $env->{REMOTE_PORT} = $self->{peer_port}; # set by peer_ip_string if (my $host = $env->{HTTP_HOST}) { @@ -169,6 +168,7 @@ sub response_write { } else { $self->write(sub { $self->close }); } + $self->{env} = undef; }; if (defined $res->[2]) { @@ -336,4 +336,10 @@ sub quit { sub event_hup { $_[0]->close } sub event_err { $_[0]->close } +# for graceful shutdown in PublicInbox::Daemon: +sub busy () { + my ($self) = @_; + ($self->{rbuf} ne '' || $self->{env} || $self->{write_buf_size}); +} + 1; |