diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-03-28 17:04:36 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-03-28 17:05:06 -0700 |
commit | 12a4c53a47bb0c7bef5e2df732fa02532a969a54 (patch) | |
tree | cff0f7c24247439496f65d09077e0f1fbb776c45 /lib/rainbows/fiber | |
parent | 801ea41a8f183785827f659fd4c1d49189797f58 (diff) | |
download | rainbows-12a4c53a47bb0c7bef5e2df732fa02532a969a54.tar.gz |
It's generally dangerous to do so regardless of language and Ruby 1.9.2dev is stricter about this sort of behaviour.
Diffstat (limited to 'lib/rainbows/fiber')
-rw-r--r-- | lib/rainbows/fiber/base.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/rainbows/fiber/base.rb b/lib/rainbows/fiber/base.rb index b731947..a056152 100644 --- a/lib/rainbows/fiber/base.rb +++ b/lib/rainbows/fiber/base.rb @@ -57,15 +57,17 @@ module Rainbows def schedule_sleepers max = nil now = Time.now + fibs = [] ZZ.delete_if { |fib, time| if now >= time - fib.resume + fibs << fib now = Time.now else max = time false end } + fibs.each { |fib| fib.resume } max.nil? || max > (now + 1) ? 1 : max - now end @@ -76,7 +78,7 @@ module Rainbows hp = HttpParser.new env = {} alive = true - remote_addr = TCPSocket === io ? io.peeraddr.last : LOCALHOST + remote_addr = Rainbows.addr(io) begin # loop while ! hp.headers(env, buf) |