

def __init__(self, tunnel):
    self.tunnel = tunnel
    self.connections = {
        
    }
    self.host = get_calvincontrol().host
    for x in range(0, 10):
        try:
            self.port = randint(5100, 5200)
            self.server = server_connection.ServerProtocolFactory(self.handle_request, 'http')
            self.server.start(self.host, self.port)
            _log.info(('Control proxy for %s listening on: %s:%s' % (tunnel.peer_node_id, self.host, self.port)))
            break
        except:
            pass
    msg = {
        'cmd': 'started',
        'controluri': ((('http://' + self.host) + ':') + str(self.port)),
    }
    self.tunnel.send(msg)

dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/runtime/north/calvincontrol.py CalvinControlTunnel.__init__/original