about summary refs log tree commit homepage
diff options
context:
space:
mode:
-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