about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-07-29 08:06:57 +0000
committerEric Wong <normalperson@yhbt.net>2010-07-29 08:06:57 +0000
commit48f6337c6ecc4f0069f147d6bbaafed969e1d19a (patch)
tree4b6fe60a29a1e2d6cc8136750703f24e3d838953
parent5479b15c766204e31495e87a64fa689141cc38a3 (diff)
downloadrainbows-48f6337c6ecc4f0069f147d6bbaafed969e1d19a.tar.gz
This makes life easier for the lazy GC when proxying
large responses (and also improves memory locality).
-rw-r--r--lib/rainbows/fiber/io.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/rainbows/fiber/io.rb b/lib/rainbows/fiber/io.rb
index 596aeae..4175eb0 100644
--- a/lib/rainbows/fiber/io.rb
+++ b/lib/rainbows/fiber/io.rb
@@ -24,11 +24,11 @@ module Rainbows
 
       # for wrapping output response bodies
       def each(&block)
-        begin
-          yield readpartial(16384)
+        if buf = readpartial(16384)
+          yield buf
+          yield buf while readpartial(16384, buf)
+        end
         rescue EOFError
-          break
-        end while true
         self
       end