Sha256: 76b429b8b807aaa0326779ea012c3d3204fc2f3f89782a827a3a65cd39727199

Contents?: true

Size: 483 Bytes

Versions: 1

Compression:

Stored size: 483 Bytes

Contents

# -*- encoding: binary -*-
# :enddoc:
module Rainbows::Coolio::Sendfile
  if IO.method_defined?(:sendfile_nonblock)
    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
    end
  else
    def rev_sendfile(body)
      write(body.to_io.sysread(0x4000))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rainbows-2.1.0 lib/rainbows/coolio/sendfile.rb