diff options
author | Eric Wong <e@80x24.org> | 2021-09-18 09:33:31 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-18 20:25:59 +0000 |
commit | 9d54d6260497a2a08bdefd25f02e817ad6505264 (patch) | |
tree | fbdae88901d1ec80fd303e7fc2a225db78c936d7 /lib/PublicInbox | |
parent | 30a88a6629af3146f68f9fe1f13054b7633559bf (diff) | |
download | public-inbox-9d54d6260497a2a08bdefd25f02e817ad6505264.tar.gz |
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://...
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/NetReader.pm | 1 |
1 files changed, 1 insertions, 0 deletions
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 |