about summary refs log tree commit homepage
path: root/lib/rainbows.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-05-09 04:39:54 +0000
committerEric Wong <normalperson@yhbt.net>2011-05-10 08:20:27 +0000
commit704f843054f3ca32941d42972a1c7d1b144d06ad (patch)
tree2e7fea212988a9a67b7cdfab3ef939a221448e65 /lib/rainbows.rb
parent598525843ee1d120fd9878011ca2b6328c2cf95f (diff)
downloadrainbows-704f843054f3ca32941d42972a1c7d1b144d06ad.tar.gz
There's actually no reason we can't have these methods
in Rainbows::Configurator where it's easier to document
nowadays.
Diffstat (limited to 'lib/rainbows.rb')
-rw-r--r--lib/rainbows.rb22
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb
index da7011a..18c9b06 100644
--- a/lib/rainbows.rb
+++ b/lib/rainbows.rb
@@ -68,30 +68,20 @@ module Rainbows
 
   # :stopdoc:
   class << self
-    attr_accessor :client_header_buffer_size
-    attr_accessor :client_max_body_size
-    attr_accessor :keepalive_timeout
     attr_accessor :server
     attr_accessor :cur # may not always be used
     attr_reader :alive
     attr_writer :tick_io
+    attr_writer :forked
   end
-  # :startdoc:
-
-  def self.defaults!
-    # the default max body size is 1 megabyte (1024 * 1024 bytes)
-    @client_max_body_size = 1024 * 1024
-
-    # the default keepalive_timeout is 5 seconds
-    @keepalive_timeout = 5
 
-    # 1024 bytes matches nginx, though Rails session cookies will typically
-    # need >= 1500...
-    @client_header_buffer_size = 1024
+  def self.config!(mod, *opts)
+    @forked or abort "#{mod} should only be loaded in a worker process"
+    opts.each do |opt|
+      mod.const_set(opt.to_s.upcase, Rainbows.server.__send__(opt))
+    end
   end
 
-  defaults!
-
   # :stopdoc:
   @alive = true
   @cur = 0