ruby-changes:23208
From: naruse <ko1@a...>
Date: Sun, 8 Apr 2012 08:41:40 +0900 (JST)
Subject: [ruby-changes:23208] naruse:r35258 (trunk): * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): get keys
naruse 2012-04-08 08:41:30 +0900 (Sun, 08 Apr 2012) New Revision: 35258 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35258 Log: * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): get keys and fetch values from it to prevent @timeout_info's error "can't add a new key into hash during iteration". Modified files: trunk/ChangeLog trunk/lib/webrick/utils.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 35257) +++ ChangeLog (revision 35258) @@ -1,3 +1,9 @@ +Sun Apr 8 07:26:40 2012 NARUSE, Yui <naruse@r...> + + * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): get keys + and fetch values from it to prevent @timeout_info's error + "can't add a new key into hash during iteration". + Sun Apr 8 06:51:57 2012 NARUSE, Yui <naruse@r...> * io.c (io_unread): cast as long the value for extra_max. Index: lib/webrick/utils.rb =================================================================== --- lib/webrick/utils.rb (revision 35257) +++ lib/webrick/utils.rb (revision 35258) @@ -175,7 +175,9 @@ Thread.start{ while true now = Time.now - @timeout_info.dup.each{|thread, ary| + @timeout_info.keys.each{|thread| + ary = @timeout_info[thread] + next unless ary ary.dup.each{|info| time, exception = *info interrupt(thread, info.object_id, exception) if time < now -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/