From 704f843054f3ca32941d42972a1c7d1b144d06ad Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 9 May 2011 04:39:54 +0000 Subject: configurator: move validation logic over There's actually no reason we can't have these methods in Rainbows::Configurator where it's easier to document nowadays. --- lib/rainbows.rb | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'lib/rainbows.rb') 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 -- cgit v1.2.3-24-ge0c7