From 37a12997628fcab722512f8a6370b92d44e33529 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 2 Oct 2009 20:44:03 -0700 Subject: initial revision No tests yet, but the old "gossamer" and "rainbows" branches seem to be basically working. --- lib/rainbows/http_server.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 lib/rainbows/http_server.rb (limited to 'lib/rainbows/http_server.rb') diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb new file mode 100644 index 0000000..355f3c5 --- /dev/null +++ b/lib/rainbows/http_server.rb @@ -0,0 +1,34 @@ +# -*- encoding: binary -*- +require 'rainbows' +module Rainbows + + class HttpServer < ::Unicorn::HttpServer + include Rainbows + + attr_accessor :worker_connections + attr_reader :use + + def initialize(app, options) + self.app = app + self.reexec_pid = 0 + self.init_listeners = options[:listeners] ? options[:listeners].dup : [] + self.config = Configurator.new(options.merge(:use_defaults => true)) + self.listener_opts = {} + config.commit!(self, :skip => [:listeners, :pid]) + + defined?(@use) or + self.use = Rainbows.const_get(:ThreadPool) + defined?(@worker_connections) or + @worker_connections = 4 + + #self.orig_app = app + end + + def use=(model) + (class << self; self; end).instance_eval { include model } + @use = model + end + + end + +end -- cgit v1.2.3-24-ge0c7