diff options
Diffstat (limited to 'lib/rainbows.rb')
-rw-r--r-- | lib/rainbows.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb index 5c8ee94..ccf211e 100644 --- a/lib/rainbows.rb +++ b/lib/rainbows.rb @@ -73,6 +73,14 @@ 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) + io.respond_to?(:peeraddr) ? + io.peeraddr.last : Unicorn::HttpRequest::LOCALHOST + end end # configures \Rainbows! with a given concurrency model to +use+ and |