media/tools/constrained_network_server/cns.py
def Cleanup(self, all_ports, request_ip=None):
    """Cleans up expired ports, or if all_ports=True, all allocated ports.

    By default, ports which haven't been used for self._expiry_time_secs are
    torn down. If all_ports=True then they are torn down regardless.

    Args:
      all_ports: Should all ports be torn down regardless of expiration?
      request_ip: Tear ports matching the IP address regarless of expiration.
    """
    with self._port_lock:
      now = time.time()
      # Use .items() instead of .iteritems() so we can delete keys w/o error.
      for port, status in self._ports.items():
        expired = now - status['last_update'] > self._expiry_time_secs
        matching_ip = request_ip and status['key'][0].startswith(request_ip)
        if all_ports or expired or matching_ip:
          cherrypy.log('Cleaning up port %d' % port)
          self._DeletePort(port)
          del self._ports[port]
Cleans up expired ports, or if all_ports=True, all allocated ports.

    By default, ports which haven't been used for self._expiry_time_secs are
    torn down. If all_ports=True then they are torn down regardless.

    Args:
      all_ports: Should all ports be torn down regardless of expiration?
      request_ip: Tear ports matching the IP address regarless of expiration.
    
Cleans up expired ports, or if all_ports=True, all allocated ports.
By default, ports which haven't been used for self._expiry_time_secs are
torn down. If all_ports=True then they are torn down regardless.
Cleans up expired ports or if all_ports = True all allocated ports . By default ports which haven ' t been used for self . _expiry_time_secs are torn down . If all_ports = True then they are torn down regardless .
def Cleanup(self, all_ports, request_ip=None):
    with self._port_lock:
      now = time.time()
      for port, status in self._ports.items():
        expired = now - status['last_update'] > self._expiry_time_secs
        matching_ip = request_ip and status['key'][0].startswith(request_ip)
        if all_ports or expired or matching_ip:
          cherrypy.log('Cleaning up port %d' % port)
          self._DeletePort(port)
          del self._ports[port]
def Cleanup ( self , all_ports , request_ip = None ) : with self . _port_lock : now = time . time ( ) for port , status in self . _ports . items ( ) : expired = now - status [ 'last_update' ] > self . _expiry_time_secs matching_ip = request_ip and status [ 'key' ] [ 0 ] . startswith ( request_ip ) if all_ports or expired or matching_ip : cherrypy . log ( 'Cleaning up port %d' % port ) self . _DeletePort ( port ) del self . _ports [ port ]
Cleans up expired ports, or if all_ports=True, all allocated ports.
Cleans up expired ports or if all_ports = True all allocated ports .
"""Cleans up expired ports, or if all_ports=True, all allocated ports.

    By default, ports which haven't been used for self._expiry_time_secs are
    torn down. If all_ports=True then they are torn down regardless.

    Args:
      all_ports: Should all ports be torn down regardless of expiration?
      request_ip: Tear ports matching the IP address regarless of expiration.
    """ # Use .items() instead of .iteritems() so we can delete keys w/o error.
self
all_ports
None
request_ip
Tear ports matching the IP address regarless of expiration.
Tear ports matching the IP address regarless of expiration .