def StatusChanged(self, status): '''Server status changed''' server_log.info('[dbus] StatusChanged: %s' % status) self._status = status # If failed to connect to web server, stop local service if self._status == constants.SERVER_STATUS_PEERID_FAILED: notify(_('Failed to get access code!')) self.Stop() # Get peeer ID successfully elif self._status == constants.SERVER_STATUS_PEERID_OK: self.connected_to_webserver = True # Show disconnection window elif self._status == constants.SERVER_STATUS_SHARING: self.remoting_connected = True self.disconnect_window = DisconnectWindow() self.disconnect_window.disconnected.connect(self.disconnected) self.disconnect_window.show() # If remote peer has closed remoting connection, terminate local service elif self._status == constants.SERVER_STATUS_DISCONNECTED: notify(_('Remoting service terminated!')) self.Stop()
def stop(self): server_log.info("[wssd] controller stopped") if self.worker_started: self.worker.stop_server() if not self.workerThread.isFinished(): self.workerThread.quit() self.workerThread.wait(1)
def StatusChanged(self, status): '''Server status changed''' server_log.info('[dbus] StatusChanged: %s' % status) self._status = status # If failed to connect to web server, stop local service if self._status == constants.SERVER_STATUS_PEERID_FAILED: notify(_('Failed to get access code!')) QtCore.QTimer.singleShot(1000, self.Stop) # Get peeer ID successfully elif self._status == constants.SERVER_STATUS_PEERID_OK: self.connected_to_webserver = True # Show disconnection window elif self._status == constants.SERVER_STATUS_SHARING: self.remoting_connected = True self.disconnect_window = DisconnectWindow() self.disconnect_window.disconnected.connect(self.Stop) self.disconnect_window.show() # If remote peer has closed remoting connection, terminate local service elif self._status == constants.SERVER_STATUS_DISCONNECTED: notify(_('Remoting service terminated!')) QtCore.QTimer.singleShot(1000, self.Stop)
def stop_server(self): server_log.info("[wssd] worker stop") if self.loop: self.loop.stop()