'The main run method of the client.
This method does not normally return. Only if there have been more than
connection_error_limit failures, the method returns and allows the
client to exit.'

def Run(self):

    while True:
        if self.http_manager.ErrorLimitReached():
            return
        self.client_worker.SendNannyMessage()
        now = time.time()
        if (now > (self.last_foreman_check + config.CONFIG['Client.foreman_check_frequency'])):
            try:
                self.client_worker.SendReply(rdf_protodict.DataBlob(), session_id=rdfvalue.FlowSessionID(flow_name='Foreman'), priority=rdf_flows.GrrMessage.Priority.LOW_PRIORITY, require_fastpoll=False, blocking=False)
                self.last_foreman_check = now
            except Queue.Full:
                pass
        try:
            self.RunOnce()
        except Exception:
            logging.warn('Uncaught    exception    caught:    %s', traceback.format_exc())
            if flags.FLAGS.debug:
                pdb.post_mortem()
        if (self.client_worker.MemoryExceeded() and (not self.client_worker.IsActive()) and (self.client_worker.InQueueSize() == 0) and (self.client_worker.OutQueueSize() == 0)):
            logging.warning('Memory    exceeded    -    exiting.')
            self.client_worker.SendClientAlert('Memory    limit    exceeded,    exiting.')
            self.client_worker.MemoryExceeded = (lambda : True)
            self.RunOnce()
            sys.exit((-1))
        self.timer.Wait()
