Method: Hiredis::Ruby::Connection#read
- Defined in:
- lib/hiredis/ruby/connection.rb
#read ⇒ Object
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/hiredis/ruby/connection.rb', line 263 def read raise "not connected" unless connected? while (reply = @reader.gets) == false begin @reader.feed @sock.read_nonblock(1024) rescue Errno::EAGAIN if IO.select([@sock], [], [], @timeout) # Readable, try again retry else # Timed out, raise raise Errno::EAGAIN end end end reply rescue ::EOFError raise Errno::ECONNRESET end |