Subject: | [PATCH] Allow specifying the Plack handler socket listen queue size |
Default to 10, which was what we used for UNIX sockets, while IP
sockets got the IO::Async::Loop default of 3.
Subject: | 0001-Allow-specifying-the-Plack-handler-socket-listen-que.patch |
From 875bb4f051e8c298e2b25974f5c5058d3ad2afce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Tue, 17 Dec 2013 17:04:43 +0000
Subject: [PATCH] Allow specifying the Plack handler socket listen queue size
Default to 10, which was what we used for UNIX sockets, while IP
sockets got the IO::Async::Loop default of 3.
---
lib/Plack/Handler/Net/Async/HTTP/Server.pm | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/Plack/Handler/Net/Async/HTTP/Server.pm b/lib/Plack/Handler/Net/Async/HTTP/Server.pm
index 439ee50..2e9cb98 100644
--- a/lib/Plack/Handler/Net/Async/HTTP/Server.pm
+++ b/lib/Plack/Handler/Net/Async/HTTP/Server.pm
@@ -38,7 +38,7 @@ sub new
delete $opts{port};
my $self = bless {
- map { $_ => delete $opts{$_} } qw( listen server_ready socket ),
+ map { $_ => delete $opts{$_} } qw( listen server_ready socket queuesize),
}, $class;
keys %opts and die "Unrecognised keys " . join( ", ", sort keys %opts );
@@ -52,6 +52,7 @@ sub run
my ( $app ) = @_;
my $loop = IO::Async::Loop->new;
+ my $queuesize = $self->{queuesize} || 10;
foreach my $listen ( @{ $self->{listen} } ) {
my $httpserver = Net::Async::HTTP::Server::PSGI->new(
@@ -69,7 +70,7 @@ sub run
my $socket = IO::Socket::UNIX->new(
Local => $path,
- Listen => 10,
+ Listen => $queuesize,
) or die "Cannot listen on $path - $!";
$httpserver->configure( handle => $socket );
@@ -81,6 +82,7 @@ sub run
host => $host,
service => $service,
socktype => "stream",
+ queuesize => $queuesize,
on_notifier => sub { $self->{server_ready} and $self->{server_ready}->() },
--
1.8.5