diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-04-02 01:32:40 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-04-02 01:32:40 -0700 |
commit | e0f9fb7cb8d8d47c68a9ebb0cb391d5880ca66d1 (patch) | |
tree | bdbd70f50dd95e6e97b634e292bb358de405b3ca | |
parent | b04d465d65f896290d36538181d91dd264d10575 (diff) | |
download | rainbows-e0f9fb7cb8d8d47c68a9ebb0cb391d5880ca66d1.tar.gz |
This gives us the option to use non-TCPSocket-derived IO-ish objects in the future, whatever that may be...
-rw-r--r-- | lib/rainbows.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb index 50db8a8..ccf211e 100644 --- a/lib/rainbows.rb +++ b/lib/rainbows.rb @@ -78,7 +78,8 @@ module Rainbows # 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 + io.respond_to?(:peeraddr) ? + io.peeraddr.last : Unicorn::HttpRequest::LOCALHOST end end |