1 # -*- encoding: binary -*-
4 # Used to keep track of file offsets in IO#sendfile_nonblock + evented
5 # models. We always maintain our own file offsets in userspace because
6 # because sendfile() implementations offer pread()-like idempotency for
7 # concurrency (multiple clients can read the same underlying file handle).
8 class Rainbows::StreamFile < Struct.new(:offset, :count, :to_io, :body)
10 body.close if body.respond_to?(:close)
11 to_io.close unless to_io.closed?