about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-06-21 07:15:22 +0000
committerEric Wong <normalperson@yhbt.net>2010-06-21 07:15:22 +0000
commit4a132122eb4f931fa721a4ff5d2204486c0c3579 (patch)
tree685cb82919db1ece1123be57563ac8381082c97b
parentf64a6781cbfbde40e4be6334520b1ff06a5e5626 (diff)
downloadrainbows-4a132122eb4f931fa721a4ff5d2204486c0c3579.tar.gz
-rw-r--r--lib/rainbows/rev/client.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/rainbows/rev/client.rb b/lib/rainbows/rev/client.rb
index 91040af..7929e32 100644
--- a/lib/rainbows/rev/client.rb
+++ b/lib/rainbows/rev/client.rb
@@ -19,18 +19,22 @@ module Rainbows
         close if @deferred_bodies.empty? && @_write_buffer.empty?
       end
 
+      # override the ::Rev::IO#write method try to write directly to the
+      # kernel socket buffers to avoid an extra userspace copy if
+      # possible.
       def write(buf)
         if @_write_buffer.empty?
-          # try to write directly to the kernel socket buffers to avoid an
-          # extra userspace copy if possible.
           begin
             w = @_io.write_nonblock(buf)
             if w == Rack::Utils.bytesize(buf)
               on_write_complete
               return w
             end
+            # we never care for the return value, but yes, we may return
+            # a "fake" short write from super(buf) if anybody cares.
             buf = buf[w..-1]
           rescue Errno::EAGAIN
+            # fall through to super(buf)
           rescue
             close
             return