code: def asynloop(self, auto_connect=False, timeout=10, detached_delay=0.2):
          
          if auto_connect:
              self.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_CONNECT))
          try:
              self.listening = True
              start = int(time.time())
              while True:
                  asyncore.loop(timeout)
                  time.sleep(detached_delay)
                  try:
                      # Execute from detached queue callback
                      callback = self.detached_queue.get(False)
                      callback()
                  except Queue.Empty:
                      pass
                  if int(time.time()) - start > timeout:
                      logger.info("Asynloop : Timeout")
                      #  defensive code should be already disconneted
                      if self.facade.connected():
                          self.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_DISCONNECT))
                      break
              self.cleanup()
          except AuthError as e:
              self.cleanup()
              raise exceptions.AuthenticationError("Authentication Error: {0}".format(e))
          except:
              self.cleanup()
              exc_info = sys.exc_info()
              traceback.print_exception(*exc_info)
              raise exceptions.UnexpectedError(str(exc_info[0]))
docs: Non-blocking event loop consuming messages until connection is lost,
             or shutdown is requested.
          :param int timeout: number of secs for asyncore timeout
          :param float detached_delay: float secs to sleep when exiting asyncore loop and execution detached queue
              callbacks