Class: Sphinx::BufferedIO

Inherits:
Net::BufferedIO
  • Object
show all
Defined in:
lib/sphinx/buffered_io.rb

Overview

A simple wrapper around Net::BufferedIO performing non-blocking select.

Constant Summary collapse

BUFSIZE =

:nodoc:

1024 * 16

Instance Method Summary collapse

Instance Method Details

#rbuf_fillObject


9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/sphinx/buffered_io.rb', line 9

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

#setsockopt(*args) ⇒ Object


23
24
25
# File 'lib/sphinx/buffered_io.rb', line 23

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