From 82167684e868e4e501713d2c03b096db6daab0a0 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 18 Aug 2009 15:00:08 -0700 Subject: Actually hook up Rainbows to the rest of the beast Allow the --rainbows/-R command-line option to be passed to activate Rainbows!!!1 --- lib/unicorn.rb | 4 +++- lib/unicorn/rainbows.rb | 2 +- lib/unicorn/rainbows/request.rb | 11 +++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 lib/unicorn/rainbows/request.rb (limited to 'lib') diff --git a/lib/unicorn.rb b/lib/unicorn.rb index b185b25..1bd88d3 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -12,6 +12,7 @@ module Unicorn autoload :Configurator, 'unicorn/configurator' autoload :TeeInput, 'unicorn/tee_input' autoload :Util, 'unicorn/util' + autoload :Rainbows, 'unicorn/rainbows' Z = '' # the stock empty string we use everywhere... Z.force_encoding(Encoding::BINARY) if Z.respond_to?(:force_encoding) @@ -19,7 +20,8 @@ module Unicorn class << self def run(app, options = {}) - HttpServer.new(app, options).start.join + klass = options.delete(:rainbows) ? Rainbows : HttpServer + klass.new(app, options).start.join end end diff --git a/lib/unicorn/rainbows.rb b/lib/unicorn/rainbows.rb index 33064c9..39fe29c 100644 --- a/lib/unicorn/rainbows.rb +++ b/lib/unicorn/rainbows.rb @@ -62,7 +62,7 @@ module Unicorn trap(:USR1) { reopen_worker_logs(worker.nr) } trap(:QUIT) { alive = false; LISTENERS.each { |s| s.close rescue nil } } [:TERM, :INT].each { |sig| trap(sig) { exit!(0) } } # instant shutdown - logger.info "worker=#{worker.nr} ready" + logger.info "worker=#{worker.nr} ready with Rainbows" begin Actor.spawn(ready.accept) { |s| process_client(s) } diff --git a/lib/unicorn/rainbows/request.rb b/lib/unicorn/rainbows/request.rb new file mode 100644 index 0000000..d2c2c65 --- /dev/null +++ b/lib/unicorn/rainbows/request.rb @@ -0,0 +1,11 @@ +module Unicorn + class Rainbows + class HttpRequest + + def initialize + end + + end + end +end + -- cgit v1.2.3-24-ge0c7