From: Eric Wong Date: Sat, 18 Sep 2021 09:33:31 +0000 (+0000) Subject: net_reader: set SO_KEEPALIVE on all Net::NNTP sockets X-Git-Tag: v1.7.0~339 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=9d54d6260497a2a08bdefd25f02e817ad6505264;p=public-inbox.git net_reader: set SO_KEEPALIVE on all Net::NNTP sockets 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://... --- diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm index a5aab650..ccfdd261 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