about summary refs log tree commit homepage
path: root/t/httpd.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-06-24 02:52:54 +0000
committerEric Wong <e@80x24.org>2019-06-24 05:26:27 +0000
commitfbcd2b5eb401a8e1811d803cef9b1c156acb50f6 (patch)
tree508abd361276280bd5d53be46f92b4167309d215 /t/httpd.t
parent4e1a84c2a97c319862c960a34e3a7a8bf31d5274 (diff)
downloadpublic-inbox-fbcd2b5eb401a8e1811d803cef9b1c156acb50f6.tar.gz
Similar to TCP_DEFER_ACCEPT on Linux, FreeBSD has a 'dataready'
accept filter which we can use to reduce wakeups when doing
TLS negotiation or plain HTTP.  There's also a 'httpready'
which we can use for plain HTTP connections.
Diffstat (limited to 't/httpd.t')
-rw-r--r--t/httpd.t10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/httpd.t b/t/httpd.t
index 8c2a3173..e085c4b9 100644
--- a/t/httpd.t
+++ b/t/httpd.t
@@ -106,6 +106,16 @@ SKIP: {
         defined(my $x = getsockopt($sock, IPPROTO_TCP, $var)) or die;
         ok(unpack('i', $x) > 0, 'TCP_DEFER_ACCEPT set');
 };
+SKIP: {
+        skip 'SO_ACCEPTFILTER is FreeBSD-only', 1 if $^O ne 'freebsd';
+        if (system('kldstat -m accf_http >/dev/null') != 0) {
+                skip 'accf_http not loaded: kldload accf_http', 1;
+        }
+        require PublicInbox::Daemon;
+        my $var = PublicInbox::Daemon::SO_ACCEPTFILTER();
+        my $x = getsockopt($sock, SOL_SOCKET, $var);
+        like($x, qr/\Ahttpready\0+\z/, 'got httpready accf for HTTP');
+};
 
 done_testing();