about summary refs log tree commit homepage
path: root/lib/rainbows/epoll.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-21 13:21:07 -0800
committerEric Wong <normalperson@yhbt.net>2011-01-21 16:54:02 -0800
commit247ce76b4aabfa42157b9cbf9ebae824819cfff6 (patch)
treeb3c61036f7befb1d9cb697193dc8a629ac362fe7 /lib/rainbows/epoll.rb
parentb33ab73a984660ab2d741b32725ab21d7860bef3 (diff)
downloadrainbows-247ce76b4aabfa42157b9cbf9ebae824819cfff6.tar.gz
We can eliminate the State module to simplify our code
since 1.3.x keeps better track of things.
Diffstat (limited to 'lib/rainbows/epoll.rb')
-rw-r--r--lib/rainbows/epoll.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/rainbows/epoll.rb b/lib/rainbows/epoll.rb
index 2f1d4a7..39c3a27 100644
--- a/lib/rainbows/epoll.rb
+++ b/lib/rainbows/epoll.rb
@@ -7,16 +7,20 @@ require 'sendfile'
 # and optimized for throughput at the expense of fairness
 module Rainbows::Epoll
   include Rainbows::Base
-  autoload :State, 'rainbows/epoll/state'
   autoload :Server, 'rainbows/epoll/server'
   autoload :Client, 'rainbows/epoll/client'
   autoload :ResponsePipe, 'rainbows/epoll/response_pipe'
   autoload :ResponseChunkPipe, 'rainbows/epoll/response_chunk_pipe'
 
+  def init_worker_process(worker)
+    super
+    Rainbows::Epoll.const_set :EP, SleepyPenguin::Epoll.new
+    trap(:QUIT) { Rainbows.quit!; EP.close unless EP.closed? }
+    Rainbows::Client.__send__ :include, Client
+  end
+
   def worker_loop(worker) # :nodoc:
     init_worker_process(worker)
-    trap(:QUIT) { Rainbows.quit!; State::EP.close unless State::EP.closed? }
-    Rainbows::Client.__send__ :include, Client
     Server.run
   end
 end