about summary refs log tree commit homepage
path: root/lib/rainbows/epoll
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-02-05 10:44:52 +0000
committerEric Wong <normalperson@yhbt.net>2011-02-05 11:13:43 +0000
commit90a86c9822238f01e8d60c9303b9a0da64351c7f (patch)
treeb13a4384b526887c964f74b1b9e2a2927e5b86bd /lib/rainbows/epoll
parentc9ca82c76f1eb0e06b0aa204a243d00f382579c5 (diff)
downloadrainbows-90a86c9822238f01e8d60c9303b9a0da64351c7f.tar.gz
acceptor thread pools could use some work, still
Diffstat (limited to 'lib/rainbows/epoll')
-rw-r--r--lib/rainbows/epoll/server.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/rainbows/epoll/server.rb b/lib/rainbows/epoll/server.rb
index a8be3e2..96b3308 100644
--- a/lib/rainbows/epoll/server.rb
+++ b/lib/rainbows/epoll/server.rb
@@ -1,8 +1,9 @@
 # -*- encoding: binary -*-
 # :nodoc:
 module Rainbows::Epoll::Server
-  IN = SleepyPenguin::Epoll::IN | SleepyPenguin::Epoll::ET
   @@nr = 0
+  Rainbows::Epoll.nr_clients = lambda { @@nr }
+  IN = SleepyPenguin::Epoll::IN | SleepyPenguin::Epoll::ET
   MAX = Rainbows.server.worker_connections
   THRESH = MAX - 1
   LISTENERS = Rainbows::HttpServer::LISTENERS
@@ -10,14 +11,7 @@ module Rainbows::Epoll::Server
 
   def self.run
     LISTENERS.each { |sock| EP.add(sock.extend(self), IN) }
-    begin
-      EP.wait(nil, 1000) { |_, obj| obj.epoll_run }
-      Rainbows::Epoll.rerun
-      Rainbows::Epoll::Client.expire
-    rescue Errno::EINTR
-    rescue => e
-      Rainbows::Error.listen_loop(e)
-    end while Rainbows.tick || @@nr > 0
+    Rainbows::Epoll.loop
   end
 
   # rearms all listeners when there's a free slot