initial revision
[rainbows.git] / lib / rainbows / http_server.rb
blob355f3c58993a7aad013ad364477936ded2b06148
1 # -*- encoding: binary -*-
2 require 'rainbows'
3 module Rainbows
5   class HttpServer < ::Unicorn::HttpServer
6     include Rainbows
8     attr_accessor :worker_connections
9     attr_reader :use
11     def initialize(app, options)
12       self.app = app
13       self.reexec_pid = 0
14       self.init_listeners = options[:listeners] ? options[:listeners].dup : []
15       self.config = Configurator.new(options.merge(:use_defaults => true))
16       self.listener_opts = {}
17       config.commit!(self, :skip => [:listeners, :pid])
19       defined?(@use) or
20         self.use = Rainbows.const_get(:ThreadPool)
21       defined?(@worker_connections) or
22         @worker_connections = 4
24       #self.orig_app = app
25     end
27     def use=(model)
28       (class << self; self; end).instance_eval { include model }
29       @use = model
30     end
32   end
34 end