diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rainbows/rev/client.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/rainbows/rev/client.rb b/lib/rainbows/rev/client.rb index 788d8c8..e51ccdc 100644 --- a/lib/rainbows/rev/client.rb +++ b/lib/rainbows/rev/client.rb @@ -21,22 +21,20 @@ module Rainbows def write(buf) if @_write_buffer.empty? - rv = buf.size # 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 == buf.size + if w == buf.bytesize on_write_complete - return rv + return w end buf = buf[w..-1] rescue Errno::EAGAIN - break # copy what's left into the IO::Buffer rescue close return - end while true + end end super(buf) end |