diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-30 12:32:48 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-30 12:32:48 +0000 |
commit | 6f226d9d42676860cdabc1e1c85cb9e9202e8ddd () | |
tree | db29b1c3bfacf7422add9224bd03c715275ac0e8 | |
parent | 99e389a6a7e098720188f6f660fb843351ffca39 (diff) |
* lib/webrick/server.rb: Use a pipe to detect server shutdown.
shutdown() or close() for listening socket is not a reliable. Actually, both doesn't work (doesn't wake up select()) on DragonFly BSD 3.6.2. * test/webrick/utils.rb: :ShutdownSocketWithoutClose is not required now to immediate server shutdown detection. This fixes fd s. * test/net/http/utils.rb: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | lib/webrick/server.rb | 27 | ||||
-rw-r--r-- | test/net/http/utils.rb | 1 | ||||
-rw-r--r-- | test/webrick/utils.rb | 1 |
4 files changed, 39 insertions, 3 deletions
@@ -1,3 +1,16 @@ Fri May 30 20:58:37 2014 Tanaka Akira <[email protected]> * test/lib/minitest/unit.rb (check_fd_): Sort the inspected @@ -115,6 +115,7 @@ module WEBrick @config[:Port] = @listeners[0].addr[1] end end end ## @@ -157,6 +158,9 @@ module WEBrick raise ServerError, "already started." if @status != :Stop server_type = @config[:ServerType] || SimpleServer server_type.start{ @logger.info \ "#{self.class}#start: pid=#{$$} port=#{@config[:Port]}" @@ -167,7 +171,10 @@ module WEBrick begin while @status == :Running begin - if svrs = IO.select(@listeners, nil, nil, 2.0) svrs[0].each{|svr| @tokens.pop # blocks while no token is there. if sock = accept_client(svr) @@ -193,6 +200,14 @@ module WEBrick end ensure @status = :Shutdown @logger.info "going to shutdown ..." thgroup.list.each{|th| th.join if th[:WEBrickThread] } @@ -218,6 +233,16 @@ module WEBrick def shutdown stop @listeners.each{|s| if @logger.debug? addr = s.addr @@ -49,7 +49,6 @@ module TestNetHTTPUtils :Port => 0, :Logger => WEBrick::Log.new(NullWriter.new), :AccessLog => [], - :ShutdownSocketWithoutClose => true, :ServerType => Thread, } server_config[:OutputBufferSize] = 4 if config('chunked') @@ -37,7 +37,6 @@ module TestWEBrick log = proc { "webrick log start:\n" + log_string.gsub(/^/, " ").chomp + "\nwebrick log end" } server = klass.new({ :BindAddress => "127.0.0.1", :Port => 0, - :ShutdownSocketWithoutClose =>true, :ServerType => Thread, :Logger => WEBrick::Log.new(logger), :AccessLog => [[logger, ""]] |