diff options
author | evanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9> | 2007-10-18 21:03:53 +0000 |
---|---|---|
committer | evanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9> | 2007-10-18 21:03:53 +0000 |
commit | 28dbbe752771c4a213f44140e3787c74770b87e6 (patch) | |
tree | 917d3a76e23015a1df8f5085126dde4507946c5d | |
parent | 8a68f2e8216142ecd41d8b020a365065029ffb07 (diff) | |
download | unicorn-28dbbe752771c4a213f44140e3787c74770b87e6.tar.gz |
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@694 19e92222-5c0b-0410-8929-a290d50e31e9
-rw-r--r-- | lib/mongrel.rb | 6 | ||||
-rw-r--r-- | lib/mongrel/configurator.rb | 14 | ||||
-rw-r--r-- | test/test_ws.rb | 6 |
3 files changed, 13 insertions, 13 deletions
diff --git a/lib/mongrel.rb b/lib/mongrel.rb index 1d95714..a320411 100644 --- a/lib/mongrel.rb +++ b/lib/mongrel.rb @@ -809,8 +809,12 @@ module Mongrel # Stops the acceptor thread and then causes the worker threads to finish # off the request queue before finally exiting. - def stop + def stop(synchronous=false) @acceptor.raise(StopServer.new) + + if synchronous + sleep(0.5) while @acceptor.alive? + end end end diff --git a/lib/mongrel/configurator.rb b/lib/mongrel/configurator.rb index 33c8f94..001401c 100644 --- a/lib/mongrel/configurator.rb +++ b/lib/mongrel/configurator.rb @@ -287,16 +287,10 @@ module Mongrel # Calls .stop on all the configured listeners so they # stop processing requests (gracefully). By default it # assumes that you don't want to restart. - def stop(needs_restart=false, synchronous=false) - - @listeners.each {|name,s| s.stop } - - if synchronous - sleep(0.5) while (@listeners.map do |name, listener| - listener.acceptor.alive? - end.any?) - end - + def stop(needs_restart=false, synchronous=false) + @listeners.each do |name,s| + s.stop(synchronous) + end @needs_restart = needs_restart end diff --git a/test/test_ws.rb b/test/test_ws.rb index 5303d40..b40a120 100644 --- a/test/test_ws.rb +++ b/test/test_ws.rb @@ -10,6 +10,8 @@ require 'mongrel' require 'timeout' require File.dirname(__FILE__) + "/testhelp.rb" +include Mongrel + class TestHandler < Mongrel::HttpHandler attr_reader :ran_test @@ -34,7 +36,7 @@ class WebServerTest < Test::Unit::TestCase end def teardown - @server.stop + @server.stop(true) end def test_simple_server @@ -57,7 +59,7 @@ class WebServerTest < Test::Unit::TestCase sleep 1 end end - s.write(" ") if RUBY_PLATFORM =~ /mingw|mswin|cygwin/ + s.write(" ") if RUBY_PLATFORM =~ /mingw|mswin|cygwin|java/ s.close end |