about summary refs log tree commit homepage
path: root/lib/rainbows/fiber
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-07-06 09:58:40 +0000
committerEric Wong <normalperson@yhbt.net>2010-07-06 10:05:13 +0000
commitd2f240d7ea11738ba889668a669ffb7845d06e7b (patch)
tree020802df1f92f750ee91f0834c09bac0e304c3a2 /lib/rainbows/fiber
parent0283928fca45a012b31662b30b49990dac2aae18 (diff)
downloadrainbows-d2f240d7ea11738ba889668a669ffb7845d06e7b.tar.gz
Fortunately this only affects the hardly-used FiberSpawn and
FiberPool concurrency models, and also unreleased revisions of
Rev.  1.9 encoding is tricky to handle right when doing I/O in
Ruby...
Diffstat (limited to 'lib/rainbows/fiber')
-rw-r--r--lib/rainbows/fiber/io.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/rainbows/fiber/io.rb b/lib/rainbows/fiber/io.rb
index d4f2512..f6b8bdf 100644
--- a/lib/rainbows/fiber/io.rb
+++ b/lib/rainbows/fiber/io.rb
@@ -7,6 +7,7 @@ module Rainbows
     # interface that yields away from the current Fiber whenever
     # the underlying IO object cannot read or write
     class IO < Struct.new(:to_io, :f)
+      include Rainbows::ByteSlice
 
       # :stopdoc:
       LOCALHOST = Unicorn::HttpRequest::LOCALHOST
@@ -58,8 +59,8 @@ module Rainbows
 
       def write(buf)
         begin
-          (w = to_io.write_nonblock(buf)) == buf.size and return
-          buf = buf[w..-1]
+          (w = to_io.write_nonblock(buf)) == buf.bytesize and return
+          buf = byte_slice(buf, w..-1)
         rescue Errno::EAGAIN
           wait_writable
           retry