def _start_server(cls, socket_handler): ready_event = threading.Event() cls.server_thread = SocketServerThread(socket_handler=socket_handler, ready_event=ready_event, host=cls.host) cls.server_thread.start() ready_event.wait() cls.port = cls.server_thread.port
def _start_server(cls, socket_handler): ready_lock = Lock() ready_lock.acquire() cls.server_thread = SocketServerThread(socket_handler=socket_handler, ready_lock=ready_lock, host=cls.host, port=cls.port) cls.server_thread.start() # Lock gets released by thread above ready_lock.acquire()
def _start_server(cls, socket_handler): ready_event = threading.Event() cls.server_thread = SocketServerThread(socket_handler=socket_handler, ready_event=ready_event, host=cls.host) cls.server_thread.start() ready_event.wait(5) if not ready_event.is_set(): raise Exception("most likely failed to start server") cls.port = cls.server_thread.port
def _start_server(cls, socket_handler: Callable[[socket.socket], None]) -> None: ready_event = threading.Event() cls.server_thread = SocketServerThread( socket_handler=socket_handler, ready_event=ready_event, host=cls.host ) cls.server_thread.USE_IPV6 = False cls.server_thread.start() ready_event.wait(5) if not ready_event.is_set(): raise Exception("most likely failed to start server") cls.port = cls.server_thread.port