diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-03-28 17:35:10 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-03-28 17:35:10 -0700 |
commit | b04d465d65f896290d36538181d91dd264d10575 (patch) | |
tree | 6e00e4ec3421c07713da4d5678c231a5f2b19d73 /lib/rainbows.rb | |
parent | 12a4c53a47bb0c7bef5e2df732fa02532a969a54 (diff) | |
download | rainbows-b04d465d65f896290d36538181d91dd264d10575.tar.gz |
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.
Diffstat (limited to 'lib/rainbows.rb')
-rw-r--r-- | lib/rainbows.rb | 7 |
1 files changed, 7 insertions, 0 deletions
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 |