Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* support remote "start-desktop" and "shadow"
* better error handling if subprocess fails to start
* client can specify which display it wants to use (especially relevant for shadow)

git-svn-id: https://xpra.org/svn/Xpra/trunk@13892 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Sep 28, 2016
1 parent 9548ebe commit e27377a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/xpra/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2117,6 +2117,8 @@ def run_remote_server(error_cb, opts, args, mode, defaults):
sns = {
"start" : start,
"start-child" : start_child,
"mode" : mode,
"display" : params.get("display", ""),
}
for x in ("exit-with-children", "exit-with-client",
"session-name", "encoding", "socket-dir", "dpi",
Expand Down Expand Up @@ -2209,7 +2211,7 @@ def start_server_subprocess(script_file, args, mode, defaults, dotxpra,
#we must use a subprocess to avoid messing things up - yuk
assert mode in ("start", "start-desktop", "shadow")
existing_sockets = set()
if mode in ("start", "start_desktop"):
if mode in ("start", "start-desktop"):
if len(args)==1:
display_name = args[0]
elif len(args)==0:
Expand Down
23 changes: 18 additions & 5 deletions src/xpra/server/proxy/proxy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
authlog = Logger("proxy", "auth")


from xpra.util import LOGIN_TIMEOUT, AUTHENTICATION_ERROR, SESSION_NOT_FOUND, repr_ellipsized, print_nested_dict, csv, typedict
from xpra.util import LOGIN_TIMEOUT, AUTHENTICATION_ERROR, SESSION_NOT_FOUND, SERVER_ERROR, repr_ellipsized, print_nested_dict, csv, typedict
from xpra.server.proxy.proxy_instance_process import ProxyInstanceProcess
from xpra.server.server_core import ServerCore
from xpra.server.control_command import ArgsControlCommand, ControlError
Expand Down Expand Up @@ -217,17 +217,30 @@ def disconnect(reason, *extras):
if len(displays)==0 or sns:
if self._start_sessions:
#start a new session
mode = sns.get("mode", "start")
assert mode in ("start", "start-desktop", "shadow"), "invalid start-new-session mode '%s'" % mode
sns = typedict(sns)
from xpra.platform.dotxpra import DotXpra
dotxpra = DotXpra(opts.socket_dir, opts.socket_dirs)
args = []
display = sns.get("display")
if display:
args = [display]
start = sns.strlistget("start")
start_child = sns.strlistget("start-child")
exit_with_children = sns.boolget("exit-with-children")
exit_with_client = sns.boolget("exit-with-client")
log("starting new server subprocess: start=%s, start-child=%s, exit-with-children=%s, exit-with-client=%s", start, start_child, exit_with_children, exit_with_client)
proc, display = start_server_subprocess(sys.argv[0], [], "start", opts, dotxpra,
start, start_child,
exit_with_children, exit_with_client)
log("starting new server subprocess: mode=%s, start=%s, start-child=%s, exit-with-children=%s, exit-with-client=%s", mode, start, start_child, exit_with_children, exit_with_client)
try:
proc, display = start_server_subprocess(sys.argv[0], args, mode, opts, dotxpra,
start, start_child,
exit_with_children, exit_with_client)
except Exception as e:
log("start_server_subprocess failed", exc_info=True)
log.error("Error: failed to start server subprocess:")
log.error(" %s", e)
disconnect(SERVER_ERROR, "failed to start a new session")
return
if proc:
self.child_reaper.add_process(proc, "server-%s" % display, "xpra start", True, True)
else:
Expand Down

0 comments on commit e27377a

Please sign in to comment.