Пример #1
0
 def _check_ports(self):
     if not 'port' in self:
         self['port'] = self.random_port(self['nb_ports'])
     else:
         port = self['port']
         if not isinstance(port, list):
             port = [port]
         in_use = [str(p) for p in port if util.is_port_in_use(p)]
         if in_use:
             raise Exception(  'Some ports were already in use: %s.'
                             % ', '.join(in_use))
Пример #2
0
 def find_nearest_port(port):
     while util.is_port_in_use(port):
         port += 1
     return port