about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rainbows/revactor.rb21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/rainbows/revactor.rb b/lib/rainbows/revactor.rb
index f602183..66a4ae3 100644
--- a/lib/rainbows/revactor.rb
+++ b/lib/rainbows/revactor.rb
@@ -18,7 +18,8 @@ module Rainbows
       buf = client.read or return # this probably does not happen...
       hp = HttpParser.new
       env = {}
-      remote_addr = client.remote_addr
+      remote_addr = ::Revactor::TCP::Socket === client ?
+                    client.remote_addr : LOCALHOST
 
       begin
         while ! hp.headers(env, buf)
@@ -69,10 +70,7 @@ module Rainbows
 
       Actor.current.trap_exit = true
 
-      listeners = LISTENERS.map do |s|
-        TCPServer === s ? ::Revactor::TCP.listen(s, nil) : nil
-      end.compact
-
+      listeners = revactorize_listeners
       logger.info "worker=#{worker.nr} ready with Revactor"
       clients = []
 
@@ -113,5 +111,18 @@ module Rainbows
       client.close rescue nil
     end
 
+    def revactorize_listeners
+      LISTENERS.map do |s|
+        if TCPServer === s
+          ::Revactor::TCP.listen(s, nil)
+        elsif defined?(::Revactor::UNIX) && UNIXServer === s
+          ::Revactor::UNIX.listen(s)
+        else
+          logger.error "your version of Revactor can't handle #{s.inspect}"
+          nil
+        end
+      end.compact
+    end
+
   end
 end