Esempio n. 1
0
    def start(self, handler_cls=RendezvousHandler):
        self._httpd, port = find_port(lambda addr: RendezvousHTTPServer(
            addr, handler_cls, self._verbose))
        if self._verbose:
            logging.info('Rendezvous INFO: HTTP rendezvous server started.')

        # start the listening loop
        self._listen_thread = in_thread(target=self._httpd.serve_forever)

        return port
Esempio n. 2
0
    def start_server(self):
        self.httpd, port = find_port(
            lambda addr: KVStoreHTTPServer(
                addr, KVStoreHandler, self.verbose))

        self.listen_thread = in_thread(target=self.httpd.serve_forever)

        if self.verbose:
            logging.info('KVStoreServer INFO: KVStore server started. Listen on port ' + str(port))

        return port
Esempio n. 3
0
 def __init__(self, service_name, key, nics):
     self._service_name = service_name
     self._wire = Wire(key)
     self._nics = nics
     self._server, _ = find_port(
         lambda addr: socketserver.ThreadingTCPServer(
             addr, self._make_handler()))
     self._server._block_on_close = True
     self._port = self._server.socket.getsockname()[1]
     self._addresses = self._get_local_addresses()
     self._thread = in_thread(target=self._server.serve_forever)