]> Sergey Matveev's repositories - public-inbox.git/commitdiff
listener: maximize listen(2) backlog
authorEric Wong <e@80x24.org>
Wed, 28 Jul 2021 00:37:19 +0000 (00:37 +0000)
committerEric Wong <e@80x24.org>
Wed, 28 Jul 2021 05:16:34 +0000 (05:16 +0000)
This helps avoid errors from script/lei dying on ECONNRESET
when a single lei-daemon is serving all tests when run via
"make check-run".

Instead of using some arbitrary limit, use INT_MAX and let
the kernel clamp it (both Linux and FreeBSD do).

There's no need to call listen() in LEI.pm, either, since
Listener->new takes care of it.

lib/PublicInbox/LEI.pm
lib/PublicInbox/Listener.pm

index 0e6e92660c9b8c5112b954e0d033f4776149b8d7..d9fd40fd90e8244399e89a252f7f55a943cc2ea5 100644 (file)
@@ -1205,7 +1205,6 @@ sub lazy_start {
        }
        umask(077) // die("umask(077): $!");
        bind($listener, $addr) or die "bind($path): $!";
-       listen($listener, 1024) or die "listen: $!";
        $lk->lock_release;
        undef $lk;
        my @st = stat($path) or die "stat($path): $!";
index c831581076a0d582dfcd44ba0ca8c65b010dd797..64bba5b0fd7c491e7e1d5641116c83581c3e85e4 100644 (file)
@@ -20,7 +20,7 @@ sub new ($$$) {
        my ($class, $s, $cb) = @_;
        setsockopt($s, SOL_SOCKET, SO_KEEPALIVE, 1);
        setsockopt($s, IPPROTO_TCP, TCP_NODELAY, 1); # ignore errors on non-TCP
-       listen($s, 1024);
+       listen($s, 2**31 - 1); # kernel will clamp
        my $self = bless { post_accept => $cb }, $class;
        $self->SUPER::new($s, EPOLLIN|EPOLLET|EPOLLEXCLUSIVE);
 }