Sha256: 67b333078d634bb2a54c98134b5bec0238d1ad1726e85bc1f353fef6ba5bbf45

Contents?: true

Size: 653 Bytes

Versions: 3

Compression:

Stored size: 653 Bytes

Contents

module BERTRPC
  # Taken with love from memcache-client.
  #
  # See http://is.gd/4CWRA for the code and
  # http://is.gd/4CYde for the discussion.
  class 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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bertrpc-0.4.1 lib/bertrpc/buffered_io.rb
bertrpc-1.1.1 lib/bertrpc/buffered_io.rb
bertrpc-1.1.0 lib/bertrpc/buffered_io.rb