diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-07-06 08:53:54 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-07-06 08:53:54 +0000 |
commit | 0283928fca45a012b31662b30b49990dac2aae18 (patch) | |
tree | 06a84a762ec4a65894b77cd0e8e17cce2066f0d1 | |
parent | 8b65858a864aa0ecfa24ccf8f910c36af0ec1ad6 (diff) | |
download | rainbows-0283928fca45a012b31662b30b49990dac2aae18.tar.gz |
non-blocking write() may cause kernel buffers to be allocated behind the scenes, so retry the write() even if it's short because it may succeed the next time around.
-rw-r--r-- | lib/rainbows/rev/client.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/rainbows/rev/client.rb b/lib/rainbows/rev/client.rb index f9284e8..f854a63 100644 --- a/lib/rainbows/rev/client.rb +++ b/lib/rainbows/rev/client.rb @@ -29,18 +29,16 @@ module Rainbows begin w = @_io.write_nonblock(buf) if w == Rack::Utils.bytesize(buf) - on_write_complete - return w + return on_write_complete 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) + break # fall through to super(buf) rescue - close - return - end + return close + end while true end super(buf) end |