def server_start_error(self, failure): controller.getInstance().log().log_error("Could not start multiplex server!") # Stop self.stop() failure.trap(CannotListenError)
def connectionLost(self, reason): controller.getInstance().log().log_debug("Closed connection to telnet Server...") self.connected = False # Notify Clients for client in self.clients: client.abortConnection()
def start(self): controller.getInstance().log().log_info("Starting multiplex server...") self.start_client() if not reactor.running: self.reactor_thread = ReactorThread() self.reactor_thread.start()
def client_start_error(self, failure): with self.lock: controller.getInstance().log().log_error("Could not connect to QEMU Monitor!") # Reset if self.client_delayed and self.client_delayed.active(): self.client_delayed.cancel() self.client = None self.client_deferred = None self.client_delayed = None # Notify self.notify_waiting_threads() failure.trap(ConnectError, CancelledError)
def stop(self): with self.lock: controller.getInstance().log().log_info("Stopping multiplex server...") if self.client: self.client.abortConnection() if self.client_delayed and self.client_delayed.active(): self.client_delayed.cancel() self.client = None self.client_deferred = None self.client_delayed = None if self.server: self.server.stopListening() self.server = None self.server_deferred = None self.notify_waiting_threads()
def connectionMade(self): controller.getInstance().log().log_debug("Established connection to telnet Server...") self.connected = True
def handleError(self, error): controller.getInstance().log().log_error(str(error))