def handle(self): input = self.request.input if input.bind_port and is_port_taken(input.bind_port): self.logger.warn('Cannot bind Zero MQ channel `%s` to TCP port %s (already taken)', input.name, input.bind_port) else: self.server.worker_store.zmq_channel_create(self.request.input) # ################################################################################################################################
def get_free_tcp_port(start=40000, stop=40500): """ Iterates between start and stop, returning first free TCP port. Must not be used except for tests because it comes with a race condition - another process may want to bind the port we find before our caller does. """ for port in xrange(start, stop): if not is_port_taken(port): return port else: raise Exception('Could not find any free TCP port between {} and {}'.format(start, stop))
def ensure_port_free(self, prefix, port, address): if is_port_taken(port): raise Exception( '{} check failed. Address `{}` already taken.'.format( prefix, address))
def ensure_port_free(self, prefix, port, address): if is_port_taken(port): raise Exception('{} check failed. Address `{}` already taken.'.format(prefix, address))