diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-11-06 19:45:17 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-11-06 19:45:17 -0800 |
commit | 1a9a718a3f9a5b582a4a339a9bb9249c2ca392d7 (patch) | |
tree | 0c95f2d8fc4de8542f7716832800614e1e7a8872 /lib/rainbows/rev.rb | |
parent | e1dcadef6ca242e36e99aab19e3e040bf01070f9 (diff) | |
download | rainbows-1a9a718a3f9a5b582a4a339a9bb9249c2ca392d7.tar.gz |
It turns out neither the EventMachine and Rev classes checked for master death in its heartbeat mechanism. Since we managed to forget the same thing twice, we now have a test case for it and also centralized the code to remove duplication.
Diffstat (limited to 'lib/rainbows/rev.rb')
-rw-r--r-- | lib/rainbows/rev.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/rainbows/rev.rb b/lib/rainbows/rev.rb index c4c77bd..66f6ed1 100644 --- a/lib/rainbows/rev.rb +++ b/lib/rainbows/rev.rb @@ -51,7 +51,7 @@ module Rainbows (@env[RACK_INPUT] = @input).rewind alive = @hp.keepalive? @env[REMOTE_ADDR] = @remote_addr - response = G.app.call(@env.update(RACK_DEFAULTS)) + response = APP.call(@env.update(RACK_DEFAULTS)) alive &&= G.alive out = [ alive ? CONN_ALIVE : CONN_CLOSE ] if @hp.headers? @@ -97,7 +97,7 @@ module Rainbows G = Rainbows::G def on_readable - return if G.cur >= G.max + return if G.cur >= MAX begin Client.new(@_io.accept_nonblock).attach(::Rev::Loop.default) rescue Errno::EAGAIN, Errno::ECONNABORTED @@ -173,8 +173,10 @@ module Rainbows # given a INT, QUIT, or TERM signal) def worker_loop(worker) init_worker_process(worker) + Client.const_set(:APP, G.server.app) + Server.const_set(:MAX, G.server.worker_connections) rloop = ::Rev::Loop.default - Heartbeat.new(worker.tmp).attach(rloop) + Heartbeat.new(1, true).attach(rloop) LISTENERS.map! { |s| Server.new(s).attach(rloop) } rloop.run end |