From 045f6d741020d4a77bd68bd80891a97782d54850 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 16 Sep 2009 16:07:16 -0700 Subject: socket_helper: (FreeBSD) don't freeze the accept filter constant We may add support for the Gopher protocol in the future... --- lib/unicorn/socket_helper.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/unicorn/socket_helper.rb b/lib/unicorn/socket_helper.rb index 18caf69..e287955 100644 --- a/lib/unicorn/socket_helper.rb +++ b/lib/unicorn/socket_helper.rb @@ -20,10 +20,8 @@ module Unicorn # Use the HTTP accept filter if available. # The struct made by pack() is defined in /usr/include/sys/socket.h # as accept_filter_arg - # We won't be seupportin the "dataready" filter unlike nginx - # since we only support HTTP and no other protocols unless `/sbin/sysctl -nq net.inet.accf.http`.empty? - HTTPREADY = ['httpready', nil].pack('a16a240').freeze + FILTER_ARG = ['httpready', nil].pack('a16a240') end end @@ -46,8 +44,8 @@ module Unicorn # No good reason to ever have deferred accepts off if defined?(TCP_DEFER_ACCEPT) sock.setsockopt(SOL_TCP, TCP_DEFER_ACCEPT, 1) rescue nil - elsif defined?(SO_ACCEPTFILTER) && defined?(HTTPREADY) - sock.setsockopt(SOL_SOCKET, SO_ACCEPTFILTER, HTTPREADY) rescue nil + elsif defined?(SO_ACCEPTFILTER) && defined?(FILTER_ARG) + sock.setsockopt(SOL_SOCKET, SO_ACCEPTFILTER, FILTER_ARG) rescue nil end end -- cgit v1.2.3-24-ge0c7