diff options
Diffstat (limited to 'lib/rainbows/xepoll')
-rw-r--r-- | lib/rainbows/xepoll/client.rb | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/lib/rainbows/xepoll/client.rb b/lib/rainbows/xepoll/client.rb index 2db684e..da0a0d1 100644 --- a/lib/rainbows/xepoll/client.rb +++ b/lib/rainbows/xepoll/client.rb @@ -2,12 +2,12 @@ # :enddoc: module Rainbows::XEpoll::Client + N = Raindrops.new(1) + Rainbows::Epoll.nr_clients = lambda { N[0] } include Rainbows::Epoll::Client MAX = Rainbows.server.worker_connections THRESH = MAX - 1 EP = Rainbows::Epoll::EP - N = Raindrops.new(1) - @timeout = Rainbows.server.timeout / 2.0 THREADS = Rainbows::HttpServer::LISTENERS.map do |sock| Thread.new(sock) do |sock| sleep @@ -25,24 +25,8 @@ module Rainbows::XEpoll::Client def self.run THREADS.each { |t| t.run } - begin - EP.wait(nil, @timeout) { |flags, 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 - - THREADS.delete_if do |thr| - Rainbows.tick - begin - thr.run - thr.join(0.01) - rescue - true - end - end until THREADS.empty? + Rainbows::Epoll.loop + Rainbows::JoinThreads.acceptors(THREADS) end # only call this once |