From 5e3247dc8d3844f2771dba6b5d316089f49ff40e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 24 Sep 2015 03:37:17 +0000 Subject: [PATCH] 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. --- public-inbox-nntpd | 4 ++++ 1 file changed, 4 insertions(+) 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}) { -- 2.44.0