diff options
-rw-r--r-- | bin/mongrel_rails | 1 | ||||
-rw-r--r-- | lib/mongrel/rails.rb | 16 |
2 files changed, 13 insertions, 4 deletions
diff --git a/bin/mongrel_rails b/bin/mongrel_rails index dd90356..40991b3 100644 --- a/bin/mongrel_rails +++ b/bin/mongrel_rails @@ -69,7 +69,6 @@ class Start < GemPlugin::Plugin "/commands" :user => @user, :group => @group, :prefix => @prefix } - if @generate STDERR.puts "** Writing config to #@generate" open(@generate, "w") {|f| f.write(settings.to_yaml) } diff --git a/lib/mongrel/rails.rb b/lib/mongrel/rails.rb index 6b4c7c1..2cd538e 100644 --- a/lib/mongrel/rails.rb +++ b/lib/mongrel/rails.rb @@ -67,11 +67,13 @@ module Mongrel cgi = Mongrel::CGIWrapper.new(request, response) cgi.handler = self - # ultra dangerous, but people are asking to kill themselves. here's the Katana - @guard.lock unless ActionController::Base.allow_concurrency + + lock! Dispatcher.dispatch(cgi, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, response.body) + unlock! + # This finalizes the output using the proper HttpResponse way cgi.out {""} rescue Errno::EPIPE @@ -80,11 +82,19 @@ module Mongrel STDERR.puts "#{Time.now}: Error calling Dispatcher.dispatch #{rails_error.inspect}" STDERR.puts rails_error.backtrace.join("\n") ensure - @guard.unlock unless ActionController::Base.allow_concurrency + unlock! end end end + def lock! + # ultra dangerous, but people are asking to kill themselves. here's the Katana + @guard.lock unless ActionController::Base.allow_concurrency + end + + def unlock! + @guard.unlock unless ActionController::Base.allow_concurrency + end # Does the internal reload for Rails. It might work for most cases, but # sometimes you get exceptions. In that case just do a real restart. |