From 4e1a84c2a97c319862c960a34e3a7a8bf31d5274 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 24 Jun 2019 02:52:53 +0000 Subject: daemon: set TCP_DEFER_ACCEPT on everything but NNTP This Linux-specific option can save us some wakeups during the TLS negotiation phase, and it can help with ordinary HTTP, too. Plain NNTP (and in the future, POP3) are the only things which require the server send messages, first. --- t/httpd.t | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't/httpd.t') diff --git a/t/httpd.t b/t/httpd.t index c061031c..8c2a3173 100644 --- a/t/httpd.t +++ b/t/httpd.t @@ -10,6 +10,7 @@ foreach my $mod (qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status)) { } use File::Temp qw/tempdir/; use IO::Socket::INET; +use Socket qw(IPPROTO_TCP); require './t/common.perl'; # FIXME: too much setup @@ -99,6 +100,13 @@ EOF 'fsck on cloned directory successful'); } +SKIP: { + skip 'TCP_DEFER_ACCEPT is Linux-only', 1 if $^O ne 'linux'; + my $var = Socket::TCP_DEFER_ACCEPT(); + defined(my $x = getsockopt($sock, IPPROTO_TCP, $var)) or die; + ok(unpack('i', $x) > 0, 'TCP_DEFER_ACCEPT set'); +}; + done_testing(); 1; -- cgit v1.2.3-24-ge0c7