about summary refs log tree commit homepage
diff options
context:
space:
mode:
-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