Exemple #1
0
 def _session_idle_check(self):
     """Checks the idle timeouts for all sessions."""
     start = time.time()
     for session in self.sessions.values():
         if session is None:
             continue
         elif not session.idle or not session.connected:
             continue
         elif (time.time() > (session.time_last_request or 0) +
               session.device.MAX_IDLE_TIME):
             logging.debug('Session disconnect (idle for %d sec): %s',
                           session.device.MAX_IDLE_TIME,
                           session.device.name)
             session.disconnect()
     # Re-schedule ourself for execution.
     elapsed = max(0, time.time() - start)
     wait_time = max(0, self._session_maint_period - elapsed)
     eventlet.spawn_after(wait_time, self._session_idle_check)
Exemple #2
0
 def _session_idle_check(self):
     """Checks the idle timeouts for all sessions."""
     start = time.time()
     for session in self.sessions.values():
         if session is None:
             continue
         elif not session.idle or not session.connected:
             continue
         elif (time.time() > (session.time_last_request or 0) +
               session.device.MAX_IDLE_TIME):
             logging.debug('Session disconnect (idle for %d sec): %s',
                           session.device.MAX_IDLE_TIME,
                           session.device.name)
             session.disconnect()
     # Re-schedule ourself for execution.
     elapsed = max(0, time.time() - start)
     wait_time = max(0, self._session_maint_period - elapsed)
     eventlet.spawn_after(
         wait_time, self._session_idle_check)
Exemple #3
0
 def stop(self):
     self._stopped.send()
     logging.debug('Disconnecting all sessions.')
     for session in self.sessions.values():
         session.disconnect()
Exemple #4
0
 def stop(self):
     self._stopped.send()
     logging.debug('Disconnecting all sessions.')
     for session in self.sessions.values():
         session.disconnect()