rainbows.git about / heads / tags Unicorn for sleepy apps and slow clients
blob 414cfa1f0209647584d6bd70ad6f6383da0d3bad 509 bytes (raw) $ git show v0.95.0:lib/rainbows/rev/sendfile.rb # shows this blob on the CLI
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
# -*- encoding: binary -*- # :enddoc: module Rainbows::Rev::Sendfile if IO.method_defined?(:sendfile_nonblock) F = Rainbows::StreamFile def to_sendfile(io) F[0, io] end def rev_sendfile(body) body.offset += @_io.sendfile_nonblock(body, body.offset, 0x10000) enable_write_watcher rescue Errno::EAGAIN enable_write_watcher end else def to_sendfile(io) io end def rev_sendfile(body) write(body.sysread(0x4000)) end end end
git clone https://yhbt.net/rainbows.git