def create_control_socket(self): assert self.socket_dir username = get_username_for_uid(self.uid) dotxpra = DotXpra(self.socket_dir, actual_username=username, uid=self.uid, gid=self.gid) sockpath = dotxpra.socket_path(":proxy-%s" % os.getpid()) state = dotxpra.get_server_state(sockpath) log("create_control_socket: socket path='%s', uid=%i, gid=%i, state=%s", sockpath, getuid(), getgid(), state) if state in (DotXpra.LIVE, DotXpra.UNKNOWN): log.error("Error: you already have a proxy server running at '%s'", sockpath) log.error(" the control socket will not be created") return False d = os.path.dirname(sockpath) try: dotxpra.mksockdir(d) except Exception as e: log.warn("Warning: failed to create socket directory '%s'", d) log.warn(" %s", e) try: sock, self.control_socket_cleanup = create_unix_domain_socket(sockpath, None, 0o600) sock.listen(5) except Exception as e: log("create_unix_domain_socket failed for '%s'", sockpath, exc_info=True) log.error("Error: failed to setup control socket '%s':", sockpath) log.error(" %s", e) return False self.control_socket = sock self.control_socket_path = sockpath log.info("proxy instance now also available using unix domain socket:") log.info(" %s", self.control_socket_path) return True
def create_control_socket(self): assert self.socket_dir dotxpra = DotXpra(self.socket_dir) sockpath = dotxpra.socket_path(":proxy-%s" % os.getpid()) state = dotxpra.get_server_state(sockpath) if state in (DotXpra.LIVE, DotXpra.UNKNOWN): log.warn( "You already have a proxy server running at %s, the control socket will not be created!", sockpath) return False try: sock, self.control_socket_cleanup = create_unix_domain_socket( sockpath, None, 0o600) sock.listen(5) except Exception as e: log("create_unix_domain_socket failed for '%s'", sockpath, exc_info=True) log.error("Error: failed to setup control socket '%s':", sockpath) log.error(" %s", e) return False self.control_socket = sock self.control_socket_path = sockpath log.info("proxy instance now also available using unix domain socket:") log.info(" %s", self.control_socket_path) return True
def create_control_socket(self): dotxpra = DotXpra(self.socket_dir) name = "proxy-%s" % os.getpid() sockpath = dotxpra.norm_make_path(name, dotxpra.sockdir()) state = dotxpra.get_server_state(sockpath) if state in (DotXpra.LIVE, DotXpra.UNKNOWN): log.warn("You already have a proxy server running at %s, the control socket will not be created!", sockpath) return False try: sock = create_unix_domain_socket(sockpath, None) sock.listen(5) except Exception, e: log.warn("failed to setup control socket %s: %s", sockpath, e) return False
def create_control_socket(self): dotxpra = DotXpra(self.socket_dir) name = "proxy-%s" % os.getpid() sockpath = dotxpra.norm_make_path(name, dotxpra.sockdir()) state = dotxpra.get_server_state(sockpath) if state in (DotXpra.LIVE, DotXpra.UNKNOWN): log.warn( "You already have a proxy server running at %s, the control socket will not be created!", sockpath) return False try: sock = create_unix_domain_socket(sockpath, None) sock.listen(5) except Exception, e: log.warn("failed to setup control socket %s: %s", sockpath, e) return False
def create_control_socket(self): dotxpra = DotXpra(self.socket_dir) name = "proxy-%s" % os.getpid() sockpath = dotxpra.norm_make_path(name, dotxpra.sockdir()) state = dotxpra.get_server_state(sockpath) if state in (DotXpra.LIVE, DotXpra.UNKNOWN): log.warn("You already have a proxy server running at %s, the control socket will not be created!", sockpath) return False try: sock = create_unix_domain_socket(sockpath, None, 0o600) sock.listen(5) except: log.warn("failed to setup control socket %s", sockpath, exc_info=True) return False self.control_socket = sock self.control_socket_path = sockpath log.info("proxy instance now also available using unix domain socket: %s", self.control_socket_path) return True
def main(): print("main()") import gtk import signal from xpra.scripts.server import create_unix_domain_socket, start_Xvfb, check_xvfb_process from xpra.scripts.main import parse_cmdline, configure_logging from xpra.platform.dotxpra import DotXpra script_file = sys.argv[0] print("main() script_file=%s" % script_file) cmdline = sys.argv print("main() cmdline=%s" % cmdline) parser, opts, args, mode = parse_cmdline(cmdline) print("main() parser=%s" % parser) print("main() options=%s" % opts) print("main() mode=%s" % mode) display_name = args.pop(0) print("main() display=%s" % display_name) assert mode == "start", "only start mode is supported by this test server" configure_logging(opts, mode) dotxpra = DotXpra(opts.socket_dir) sockpath = dotxpra.socket_path(display_name) socket, cleanup_socket = create_unix_domain_socket(sockpath) sockets = [socket] xvfb = start_Xvfb(opts.xvfb, display_name) assert check_xvfb_process(xvfb), "xvfb error" from xpra.x11.bindings import posix_display_source #@UnusedImport from xpra.x11.bindings.window_bindings import X11WindowBindings #@UnresolvedImport X11Window = X11WindowBindings() assert X11Window try: app = UnrespondingServer() app.init(opts) app.init_sockets(sockets) signal.signal(signal.SIGTERM, app.signal_quit) signal.signal(signal.SIGINT, app.signal_quit) return app.run() finally: for display in gtk.gdk.display_manager_get().list_displays(): display.close() xvfb.terminate() cleanup_socket()
def create_control_socket(self): assert self.socket_dir dotxpra = DotXpra(self.socket_dir) sockpath = dotxpra.socket_path(":proxy-%s" % os.getpid()) state = dotxpra.get_server_state(sockpath) if state in (DotXpra.LIVE, DotXpra.UNKNOWN): log.warn("You already have a proxy server running at %s, the control socket will not be created!", sockpath) return False try: sock = create_unix_domain_socket(sockpath, None, 0o600) sock.listen(5) except Exception as e: log("create_unix_domain_socket failed for '%s'", sockpath, exc_info=True) log.error("Error: failed to setup control socket '%s':", sockpath) log.error(" %s", e) return False self.control_socket = sock self.control_socket_path = sockpath log.info("proxy instance now also available using unix domain socket:") log.info(" %s", self.control_socket_path) return True
def create_control_socket(self): dotxpra = DotXpra(self.socket_dir) name = "proxy-%s" % os.getpid() sockpath = dotxpra.norm_make_path(name, dotxpra.sockdir()) state = dotxpra.get_server_state(sockpath) if state in (DotXpra.LIVE, DotXpra.UNKNOWN): log.warn( "You already have a proxy server running at %s, the control socket will not be created!", sockpath) return False try: sock = create_unix_domain_socket(sockpath, None, 0o600) sock.listen(5) except: log.warn("failed to setup control socket %s", sockpath, exc_info=True) return False self.control_socket = sock self.control_socket_path = sockpath log.info( "proxy instance now also available using unix domain socket: %s", self.control_socket_path) return True