diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-07-22 05:42:16 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-07-22 09:09:37 +0000 |
commit | 416d3a0f868571319a2b29b0034d2dba68e4d5b3 (patch) | |
tree | 081bdbdcce23063667c707212ceda45bbc322675 /lib/rainbows/rev/sendfile.rb | |
parent | 015daa81f26afc59d1da857b8bbedfb80eb532b1 (diff) | |
download | rainbows-416d3a0f868571319a2b29b0034d2dba68e4d5b3.tar.gz |
The FileStreamer class of EventMachine (and by extension NeverBlock) unfortunately doesn't handle this. It's possible to do with Revactor (since it uses Rev under the covers), but we'll support what we can easily for now.
Diffstat (limited to 'lib/rainbows/rev/sendfile.rb')
-rw-r--r-- | lib/rainbows/rev/sendfile.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/rainbows/rev/sendfile.rb b/lib/rainbows/rev/sendfile.rb index 9f421f1..42368a1 100644 --- a/lib/rainbows/rev/sendfile.rb +++ b/lib/rainbows/rev/sendfile.rb @@ -2,8 +2,9 @@ # :enddoc: module Rainbows::Rev::Sendfile if IO.method_defined?(:sendfile_nonblock) - def rev_sendfile(body) - body.offset += @_io.sendfile_nonblock(body, body.offset, 0x10000) + def rev_sendfile(sf) # +sf+ is a Rainbows::StreamFile object + sf.offset += (n = @_io.sendfile_nonblock(sf, sf.offset, sf.count)) + 0 == (sf.count -= n) and raise EOFError enable_write_watcher rescue Errno::EAGAIN enable_write_watcher |