about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-08-12 19:01:06 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-08-12 19:01:06 +0000
commitf9f5412a096e842598591916e0eff1e9356650ea (patch)
treeb2a0ef88b3aa57e4f5d8a04e3aec79ec9b085db5
parentd5b23a5a61568e51ca89adfc86d0f42fd27cee5d (diff)
downloadunicorn-f9f5412a096e842598591916e0eff1e9356650ea.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@313 19e92222-5c0b-0410-8929-a290d50e31e9
-rw-r--r--bin/mongrel_rails1
-rw-r--r--lib/mongrel/rails.rb16
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.