mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/webrick/server.rb (WEBrick::GenericServer#stop): fix r35303;
this method is to deny new connections, not shutdown yet. * lib/webrick/server.rb (WEBrick::GenericServer#start): re-raise exception only when the exception is Interrupt (^C). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d2e69f8584
commit
deb0519aec
3 changed files with 23 additions and 15 deletions
|
|
@ -29,23 +29,22 @@ class TestWEBrickServer < Test::Unit::TestCase
|
|||
:StopCallback => Proc.new{ stopped += 1 },
|
||||
}
|
||||
|
||||
e = assert_raises(Exception) do
|
||||
e = assert_raises(Interrupt) do
|
||||
TestWEBrick.start_server(Echo, config) { |server, addr, port, log|
|
||||
listener = server.listeners.first
|
||||
|
||||
def listener.accept
|
||||
raise Exception, 'fatal' # simulate ^C
|
||||
Process.kill(:INT, $$) # simulate ^C
|
||||
end
|
||||
|
||||
true while server.status != :Running
|
||||
Thread.pass while server.status != :Running
|
||||
|
||||
TCPSocket.open(addr, port) { |sock| sock << "foo\n" }
|
||||
|
||||
sleep 0.1 until server.status == :Stop
|
||||
Thread.pass until server.status == :Stop
|
||||
}
|
||||
end
|
||||
|
||||
assert_equal('fatal', e.message)
|
||||
assert_equal(stopped, 1)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue