From f824f4e13a13daf56439e16ecb3a62469a8c9bf0 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 28 Nov 2009 11:43:45 -0800 Subject: always set FD_CLOEXEC if available Some people fork processes, so it avoid hanging a connection open because of that... --- lib/rainbows/revactor.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/rainbows/revactor.rb') diff --git a/lib/rainbows/revactor.rb b/lib/rainbows/revactor.rb index 4e4b381..9a18157 100644 --- a/lib/rainbows/revactor.rb +++ b/lib/rainbows/revactor.rb @@ -30,6 +30,8 @@ module Rainbows # once a client is accepted, it is processed in its entirety here # in 3 easy steps: read request, call app, write app response def process_client(client) + defined?(Fcntl::FD_CLOEXEC) and + client.instance_eval { @_io.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) } rd_args = [ nil ] remote_addr = if ::Revactor::TCP::Socket === client rd_args << RD_ARGS -- cgit v1.2.3-24-ge0c7