Skip to content

Commit

Permalink
#1939: expose minimal information via dbus for the proxy server
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@20186 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Aug 24, 2018
1 parent 63f26d5 commit 0b3fa7e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/xpra/server/proxy/proxy_dbus_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def __init__(self, server=None):

@dbus.service.method(INTERFACE, in_signature='', out_signature='a{sv}')
def GetInfo(self):
i = self.server.get_info(None)
#full info is available by calling get_info()
i = self.server.get_minimal_server_info()
self.log(".GetInfo()=%s", i)
try:
v = dbus.types.Dictionary((str(k), native_to_dbus(v)) for k,v in i.items())
Expand Down
49 changes: 31 additions & 18 deletions src/xpra/server/server_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1760,6 +1760,35 @@ def get_ui_info(self, _proto, *_args):
def get_thread_info(self, proto):
return get_thread_info(proto)

def get_minimal_server_info(self):
info = {
"mode" : self.get_server_mode(),
"session-type" : self.session_type,
"type" : "Python",
"python" : {"version" : python_platform.python_version()},
"start_time" : int(self.start_time),
"uuid" : self.uuid,
}
return info

def get_server_info(self):
#this function is for non UI thread info
si = {}
si.update(self.get_minimal_server_info())
si.update(get_server_info())
si.update({
"argv" : sys.argv,
"path" : sys.path,
"exec_prefix" : sys.exec_prefix,
"executable" : sys.executable,
"idle-timeout" : int(self.server_idle_timeout),
})
if POSIX:
si["load"] = tuple(int(x*1000) for x in os.getloadavg())
if self.original_desktop_display:
si["original-desktop-display"] = self.original_desktop_display
return si

def get_info(self, proto, *_args):
start = monotonic_time()
#this function is for non UI thread info
Expand All @@ -1772,25 +1801,9 @@ def up(prefix, d):
if filtered_env.get('XPRA_ENCRYPTION_KEY'):
filtered_env['XPRA_ENCRYPTION_KEY'] = "*****"

si = get_server_info()
si.update({
"mode" : self.get_server_mode(),
"session-type" : self.session_type,
"type" : "Python",
"python" : {"version" : python_platform.python_version()},
"start_time" : int(self.start_time),
"idle-timeout" : int(self.server_idle_timeout),
"argv" : sys.argv,
"path" : sys.path,
"exec_prefix" : sys.exec_prefix,
"executable" : sys.executable,
"uuid" : self.uuid,
})
if POSIX:
si["load"] = tuple(int(x*1000) for x in os.getloadavg())
if self.original_desktop_display:
si["original-desktop-display"] = self.original_desktop_display
si = self.get_server_info()
up("server", si)

ni = get_net_info()
ni.update({
"sockets" : self.get_socket_info(),
Expand Down

0 comments on commit 0b3fa7e

Please sign in to comment.