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 | |
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')
-rw-r--r-- | lib/PublicInbox/HTTP.pm | 8 | ||||
-rw-r--r-- | lib/PublicInbox/NNTP.pm | 1 |
2 files changed, 8 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; diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 097c57e9..bcce7703 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -954,6 +954,7 @@ sub watch_read { $rv; } +# for graceful shutdown in PublicInbox::Daemon: sub busy () { my ($self) = @_; ($self->{rbuf} ne '' || $self->{long_res} || $self->{write_buf_size}); |