diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-05-19 23:54:59 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-05-20 08:32:39 +0000 |
commit | 90af18f6884857704d72fd6b2bb91718aad72117 (patch) | |
tree | 3aad09eaac6d20d8f158d1fd7b1caad53f27ce2f /lib/rainbows/xepoll/client.rb | |
parent | 5e4f790847198e1267b2fbd5decfa09e5cc3d618 (diff) | |
download | rainbows-90af18f6884857704d72fd6b2bb91718aad72117.tar.gz |
There's less logic in the server this way and easier to potentially share code this way.
Diffstat (limited to 'lib/rainbows/xepoll/client.rb')
-rw-r--r-- | lib/rainbows/xepoll/client.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/rainbows/xepoll/client.rb b/lib/rainbows/xepoll/client.rb index c7eebcc..4f15a73 100644 --- a/lib/rainbows/xepoll/client.rb +++ b/lib/rainbows/xepoll/client.rb @@ -3,9 +3,7 @@ module Rainbows::XEpoll::Client N = Raindrops.new(1) - Rainbows::Epoll.nr_clients = lambda { N[0] } include Rainbows::Epoll::Client - EP = Rainbows::Epoll::EP ACCEPTORS = Rainbows::HttpServer::LISTENERS.dup extend Rainbows::WorkerYield @@ -26,8 +24,17 @@ module Rainbows::XEpoll::Client end end - def self.run - Rainbows::Epoll.loop + def self.loop + begin + EP.wait(nil, 1000) { |_, obj| obj.epoll_run } + while obj = ReRun.shift + obj.epoll_run + end + Rainbows::Epoll::Client.expire + rescue Errno::EINTR + rescue => e + Rainbows::Error.listen_loop(e) + end while Rainbows.tick || N[0] > 0 Rainbows::JoinThreads.acceptors(ACCEPTORS) end |