From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 9DBCE633844 for ; Thu, 24 Sep 2015 03:37:23 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/7] nntpd: hard quit after 30s Date: Thu, 24 Sep 2015 03:37:17 +0000 Message-Id: <20150924033721.26231-4-e@80x24.org> In-Reply-To: <20150924033721.26231-1-e@80x24.org> References: <20150924033721.26231-1-e@80x24.org> List-Id: 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 defb16b..4c15608 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}) { -- EW