diff options
Diffstat (limited to 'lib/rainbows/http_server.rb')
-rw-r--r-- | lib/rainbows/http_server.rb | 34 |
1 files changed, 34 insertions, 0 deletions
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 |