diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-06-21 07:15:22 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-06-21 07:15:22 +0000 |
commit | 4a132122eb4f931fa721a4ff5d2204486c0c3579 (patch) | |
tree | 685cb82919db1ece1123be57563ac8381082c97b | |
parent | f64a6781cbfbde40e4be6334520b1ff06a5e5626 (diff) | |
download | rainbows-4a132122eb4f931fa721a4ff5d2204486c0c3579.tar.gz |
-rw-r--r-- | lib/rainbows/rev/client.rb | 8 |
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 |