class Redis::Client

def read

def read
  begin
    connection.read
  rescue Errno::EAGAIN
    # We want to make sure it reconnects on the next command after the
    # timeout. Otherwise the server may reply in the meantime leaving
    # the protocol in a desync status.
    disconnect
    raise Errno::EAGAIN, "Timeout reading from the socket"
  rescue Errno::ECONNRESET
    raise Errno::ECONNRESET, "Connection lost"
  end
end