Sha256: 8a81636ad3ea1032867e412fd0835279fd49ed381a94520475d3682021586392

Contents?: true

Size: 567 Bytes

Versions: 6

Compression:

Stored size: 567 Bytes

Contents

# A simple wrapper around <tt>Net::BufferedIO</tt> performing
# non-blocking select.
#
# @private
class Sphinx::BufferedIO < Net::BufferedIO # :nodoc:
  BUFSIZE = 1024 * 16

  if RUBY_VERSION < '1.9.1'
    def rbuf_fill
      begin
        @rbuf << @io.read_nonblock(BUFSIZE)
      rescue Errno::EWOULDBLOCK
        retry unless @read_timeout
        if IO.select([@io], nil, nil, @read_timeout)
          retry
        else
          raise Timeout::Error, 'IO timeout'
        end
      end
    end
  end

  def setsockopt(*args)
    @io.setsockopt(*args)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sphinx-2.1.1.3712 lib/sphinx/buffered_io.rb
sphinx-2.1.1.3711 lib/sphinx/buffered_io.rb
sphinx-0.9.9.2117 lib/sphinx/buffered_io.rb
sphinx-0.9.10.2122 lib/sphinx/buffered_io.rb
sphinx-0.9.10.2094 lib/sphinx/buffered_io.rb
sphinx-0.9.10.2091 lib/sphinx/buffered_io.rb