about summary refs log tree commit homepage
path: root/lib/rainbows/http_server.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-10-02 20:44:03 -0700
committerEric Wong <normalperson@yhbt.net>2009-10-02 21:21:28 -0700
commit37a12997628fcab722512f8a6370b92d44e33529 (patch)
tree9ced4ceaee3d4d6ce21dd1742f037d1d79a01e61 /lib/rainbows/http_server.rb
downloadrainbows-37a12997628fcab722512f8a6370b92d44e33529.tar.gz
No tests yet, but the old "gossamer" and "rainbows" branches
seem to be basically working.
Diffstat (limited to 'lib/rainbows/http_server.rb')
-rw-r--r--lib/rainbows/http_server.rb34
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