From 4a132122eb4f931fa721a4ff5d2204486c0c3579 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 21 Jun 2010 07:15:22 +0000 Subject: rev: documentation update for #write method --- lib/rainbows/rev/client.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3-24-ge0c7