about summary refs log tree commit homepage
path: root/lib/rainbows.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-04-02 01:32:40 -0700
committerEric Wong <normalperson@yhbt.net>2010-04-02 01:32:40 -0700
commite0f9fb7cb8d8d47c68a9ebb0cb391d5880ca66d1 (patch)
treebdbd70f50dd95e6e97b634e292bb358de405b3ca /lib/rainbows.rb
parentb04d465d65f896290d36538181d91dd264d10575 (diff)
downloadrainbows-e0f9fb7cb8d8d47c68a9ebb0cb391d5880ca66d1.tar.gz
This gives us the option to use non-TCPSocket-derived
IO-ish objects in the future, whatever that may be...
Diffstat (limited to 'lib/rainbows.rb')
-rw-r--r--lib/rainbows.rb3
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