* lib/webrick/server.rb: Setup shutdown pipe in listen method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2014-11-10 11:05:00 +00:00
parent fd9f6bde95
commit 33bb38a644
4 changed files with 45 additions and 1 deletions

View file

@ -115,7 +115,6 @@ module WEBrick
if @config[:Port] == 0
@config[:Port] = @listeners[0].addr[1]
end
@shutdown_pipe = IO.pipe
end
end
@ -132,6 +131,7 @@ module WEBrick
def listen(address, port)
@listeners += Utils::create_listeners(address, port, @logger)
setup_shutdown_pipe
end
##
@ -321,6 +321,13 @@ module WEBrick
end
end
def setup_shutdown_pipe
if !@shutdown_pipe
@shutdown_pipe = IO.pipe
end
@shutdown_pipe
end
def cleanup_shutdown_pipe(shutdown_pipe)
@shutdown_pipe = nil
shutdown_pipe.each {|io|