From 47e1ee2d90161abf92ce14562bf508398fdfa6c9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 25 Aug 2010 13:58:11 -0700 Subject: split out accept() callers to acceptor module Trying to avoid adding singleton methods since it's too easily accessible by the public and not needed by the general public. This also allows us (or just Zbatery) to more easily add support systems without FD_CLOEXEC or fcntl, and also to optimize away a fcntl call for systems that inherit FD_CLOEXEC. --- lib/rainbows.rb | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'lib/rainbows.rb') diff --git a/lib/rainbows.rb b/lib/rainbows.rb index 52e7519..f80d5fd 100644 --- a/lib/rainbows.rb +++ b/lib/rainbows.rb @@ -75,22 +75,6 @@ module Rainbows HttpServer.new(app, options).start.join end - # returns nil if accept fails - def sync_accept(sock) # :nodoc: - rv = sock.accept - rv.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) - rv - rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EINTR - end - - # returns nil if accept fails - def accept(sock) # :nodoc: - rv = sock.accept_nonblock - rv.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) - rv - rescue Errno::EAGAIN, Errno::ECONNABORTED - end - # returns a string representing the address of the given client +io+ # For local UNIX domain sockets, this will return a string referred # to by the (non-frozen) Unicorn::HttpRequest::LOCALHOST constant. @@ -139,3 +123,4 @@ module Rainbows autoload :HttpResponse, 'rainbows/http_response' # deprecated autoload :ThreadTimeout, 'rainbows/thread_timeout' end +require 'rainbows/acceptor' -- cgit v1.2.3-24-ge0c7