socket_helper: tunables for tcp_defer_accept/accept_filter
commita88bed858dfa20b5131b631739b340da9dceae99
authorEric Wong <normalperson@yhbt.net>
Sat, 3 Jul 2010 09:30:57 +0000 (3 09:30 +0000)
committerEric Wong <normalperson@yhbt.net>
Tue, 6 Jul 2010 21:39:40 +0000 (6 14:39 -0700)
treec5bbfa682f5c0944ff412bd901798e0431cc9596
parent85d55f6450f3546d3211be247919a2dae03a1110
socket_helper: tunables for tcp_defer_accept/accept_filter

Under Linux, this allows users to tune the time (in seconds) to
defer connections before allowing them to be accepted.  The
behavior of TCP_DEFER_ACCEPT changed with Linux 2.6.32 and idle
connections may still be accept()-ed after the specified value
in seconds.  A small value of '1' remains the default for
Unicorn as Unicorn does not worry about slow clients.  Higher
values provide better DoS protection for Rainbows! but also
increases kernel memory usage.

Allowing "dataready" for FreeBSD accept filters will allow
SSL sockets to be used in the future for HTTPS, too.
(cherry picked from commit 646cc762cc9297510102fc094f3af8a5a9e296c7)
lib/unicorn/socket_helper.rb
test/unit/test_socket_helper.rb