diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-06-18 09:44:57 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-06-18 09:44:57 +0000 |
commit | 679a4b4673f66a299322facfe2acb8776bf61c00 (patch) | |
tree | 83c97497b8fef13505cccefb9df05be4dcbf70f2 | |
parent | e5bd756d0a8ab73cab16facbd6f1b2275f6dfa21 (diff) | |
download | rainbows-679a4b4673f66a299322facfe2acb8776bf61c00.tar.gz |
I was originally experimenting with setsockopt to increase the kernel buffer sizes in a loop, but the benefits were negligible at best.
-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 |