about summary refs log tree commit homepage
path: root/public-inbox-nntpd
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-24 03:37:17 +0000
committerEric Wong <e@80x24.org>2015-09-24 06:58:30 +0000
commit5e3247dc8d3844f2771dba6b5d316089f49ff40e (patch)
treea4d52c5b7aa52af74efc58ff4996a1ccc9747aa7 /public-inbox-nntpd
parente70783a70de4ea4f213eba6ca9485f70797cb61a (diff)
downloadpublic-inbox-5e3247dc8d3844f2771dba6b5d316089f49ff40e.tar.gz
We don't want clients hogging server resources and preventing
us from shutting down, so give them 30s to finish whatever
request they're getting.
Diffstat (limited to 'public-inbox-nntpd')
-rw-r--r--public-inbox-nntpd4
1 files changed, 4 insertions, 0 deletions
diff --git a/public-inbox-nntpd b/public-inbox-nntpd
index defb16b1..4c156080 100644
--- a/public-inbox-nntpd
+++ b/public-inbox-nntpd
@@ -195,10 +195,14 @@ sub worker_quit {
         $_->close for @listeners;
         @listeners = ();
 
+        # give slow clients 30s to finish reading/writing whatever
+        Danga::Socket->AddTimer(30, sub { exit });
+
         # drop idle connections and try to quit gracefully
         Danga::Socket->SetPostLoopCallback(sub {
                 my ($dmap, undef) = @_;
                 my $n = 0;
+
                 foreach my $s (values %$dmap) {
                         next unless ref($s) eq 'PublicInbox::NNTP';
                         if ($s->{write_buf_size} || $s->{rbuf}) {