From: Eric Wong Date: Thu, 24 Sep 2015 03:37:17 +0000 (+0000) Subject: nntpd: hard quit after 30s X-Git-Tag: v1.0.0~839 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=5e3247dc8d3844f2771dba6b5d316089f49ff40e;p=public-inbox.git nntpd: hard quit after 30s 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. --- 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}) {