From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5F18D1FC0C for ; Sat, 18 Sep 2021 09:33:34 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 8/9] net_reader: set SO_KEEPALIVE on all Net::NNTP sockets Date: Sat, 18 Sep 2021 09:33:31 +0000 Message-Id: <20210918093332.16054-9-e@80x24.org> In-Reply-To: <20210918093332.16054-1-e@80x24.org> References: <20210918093332.16054-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: SO_KEEPALIVE can prevent stuck processes and is safe to enable unconditionally on all TCP sockets (like git, and the rest of public-inbox does). Verified via strace on both NNTP and NNTPS with and without nntp.proxy=socks5h://... --- lib/PublicInbox/NetReader.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm index 403df952..28e20d38 100644 --- a/lib/PublicInbox/NetReader.pm +++ b/lib/PublicInbox/NetReader.pm @@ -182,6 +182,7 @@ sub nn_new ($$$) { } else { $nn = Net::NNTP->new(%$nn_arg) or return; } + setsockopt($nn, Socket::SOL_SOCKET(), Socket::SO_KEEPALIVE(), 1); # default to using STARTTLS if it's available, but allow # it to be disabled for localhost/VPN users