mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
how's this
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@688 19e92222-5c0b-0410-8929-a290d50e31e9
This commit is contained in:
parent
9b23459be9
commit
06c1d5492b
4 changed files with 19 additions and 11 deletions
|
@ -809,13 +809,11 @@ module Mongrel
|
|||
|
||||
# Stops the acceptor thread and then causes the worker threads to finish
|
||||
# off the request queue before finally exiting.
|
||||
def stop(asynchronous=true)
|
||||
if asynchronous
|
||||
stopper = Thread.new { @acceptor.raise(StopServer.new) }
|
||||
stopper.priority = 10
|
||||
else
|
||||
def stop
|
||||
stopper = Thread.new do
|
||||
@acceptor.raise(StopServer.new)
|
||||
end
|
||||
stopper.priority = 10
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -288,9 +288,14 @@ module Mongrel
|
|||
# stop processing requests (gracefully). By default it
|
||||
# assumes that you don't want to restart.
|
||||
def stop(needs_restart=false, asynchronous=true)
|
||||
@listeners.each {|name,s|
|
||||
s.stop(asynchronous)
|
||||
}
|
||||
|
||||
@listeners.each {|name,s| s.stop }
|
||||
|
||||
unless asynchronous
|
||||
sleep(0.5) while (@listeners.map do |name, listener|
|
||||
listener.acceptor.alive?
|
||||
end.any?)
|
||||
end
|
||||
|
||||
@needs_restart = needs_restart
|
||||
end
|
||||
|
|
|
@ -77,9 +77,9 @@ class ConfiguratorTest < Test::Unit::TestCase
|
|||
assert $test_plugin_fired == 6, "Test filter plugin didn't run 6 times."
|
||||
end
|
||||
|
||||
redirect_test_io do
|
||||
config.stop(false, true)
|
||||
end
|
||||
# redirect_test_io do
|
||||
config.stop(false, false)
|
||||
# end
|
||||
|
||||
assert_raise Errno::EBADF, Errno::ECONNREFUSED do
|
||||
res = Net::HTTP.get(URI.parse("http://localhost:4501/"))
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
# Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html
|
||||
# for more information.
|
||||
|
||||
if ENV['DEBUG']
|
||||
require 'ruby-debug'
|
||||
Debugger.start
|
||||
end
|
||||
|
||||
def redirect_test_io
|
||||
orig_err = STDERR.dup
|
||||
orig_out = STDOUT.dup
|
||||
|
|
Loading…
Reference in a new issue