diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-10-11 01:51:27 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-10-11 01:51:27 -0700 |
commit | 03b7904f597d80ed7c8e5ae19e2af8d0e0c581ba (patch) | |
tree | 957914a5e7fd5d197455e056f33aff6b96843d1d /lib/rainbows/base.rb | |
parent | 427ac38fe3eeadad1d6fb897bd835607a9372aad (diff) | |
download | rainbows-03b7904f597d80ed7c8e5ae19e2af8d0e0c581ba.tar.gz |
This can be common across everything
Diffstat (limited to 'lib/rainbows/base.rb')
-rw-r--r-- | lib/rainbows/base.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/rainbows/base.rb b/lib/rainbows/base.rb index da3fff0..2da6d41 100644 --- a/lib/rainbows/base.rb +++ b/lib/rainbows/base.rb @@ -22,6 +22,19 @@ module Rainbows logger.error e.backtrace.join("\n") end + def init_worker_process(worker) + super(worker) + + # we're don't use the self-pipe mechanism in the Rainbows! worker + # since we don't defer reopening logs + HttpServer::SELF_PIPE.each { |x| x.close }.clear + trap(:USR1) { reopen_worker_logs(worker.nr) rescue nil } + # closing anything we IO.select on will raise EBADF + trap(:QUIT) { HttpServer::LISTENERS.map! { |s| s.close rescue nil } } + [:TERM, :INT].each { |sig| trap(sig) { exit(0) } } # instant shutdown + logger.info "Rainbows! #@use worker_connections=#@worker_connections" + end + # once a client is accepted, it is processed in its entirety here # in 3 easy steps: read request, call app, write app response def process_client(client) |