From b04d465d65f896290d36538181d91dd264d10575 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 28 Mar 2010 17:35:10 -0700 Subject: cleanup: avoid redundant REMOTE_ADDR logic Every concurrency model does this the same way. This removes the Rainbows::Const::LOCALHOST constant and may break some existing apps that rely on it. --- lib/rainbows.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/rainbows.rb') diff --git a/lib/rainbows.rb b/lib/rainbows.rb index 5c8ee94..50db8a8 100644 --- a/lib/rainbows.rb +++ b/lib/rainbows.rb @@ -73,6 +73,13 @@ module Rainbows 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. + def addr(io) + TCPSocket == io ? io.peeraddr.last : Unicorn::HttpRequest::LOCALHOST + end end # configures \Rainbows! with a given concurrency model to +use+ and -- cgit v1.2.3-24-ge0c7