[X2Go-Commits] [python-x2go] 01/01: Make X2GoClient's constructor aware of non-usable X-Server ports.

git-admin at x2go.org git-admin at x2go.org
Wed Apr 16 10:27:45 CEST 2014


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository python-x2go.

commit f4e64e846083312868b91f85ca0abba3bed1e140
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Apr 16 10:27:43 2014 +0200

    Make X2GoClient's constructor aware of non-usable X-Server ports.
---
 debian/changelog |    1 +
 x2go/client.py   |   17 +++++++++--------
 x2go/xserver.py  |    3 +++
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ae10b34..df75e29 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -35,6 +35,7 @@ python-x2go (0.5.0.0-0x2go1) UNRELEASED; urgency=low
       current X2Go application.
     - Session profiles: default value type for exports session profile option
       is an empty dictionary.
+    - Make X2GoClient's constructor aware of non-usable X-Server ports.
   * debian/control:
     + Add dependencies: python-requests, python-simplejson.
   * python-x2go.spec:
diff --git a/x2go/client.py b/x2go/client.py
index b7fbb8a..b0bffa0 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -325,11 +325,11 @@ class X2GoClient(object):
                 if  type(start_xserver) is types.BooleanType:
                     p_xs_name = self.client_xconfig.preferred_xserver_names[0]
                     _last_display = self.client_xconfig.get_xserver_config(p_xs_name)['last_display']
-                    self.client_xconfig.detect_unused_xdisplay_port(p_xs_name)
+                    _new_display = self.client_xconfig.detect_unused_xdisplay_port(p_xs_name)
                     p_xs = (p_xs_name, self.client_xconfig.get_xserver_config(p_xs_name))
                 elif type(start_xserver) is types.StringType:
                     _last_display = self.client_xconfig.get_xserver_config(start_xserver)['last_display']
-                    self.client_xconfig.detect_unused_xdisplay_port(start_xserver)
+                    _new_display = self.client_xconfig.detect_unused_xdisplay_port(start_xserver)
                     p_xs = (start_xserver, self.client_xconfig.get_xserver_config(start_xserver))
 
                 if not self.client_xconfig.running_xservers:
@@ -340,12 +340,13 @@ class X2GoClient(object):
                 else:
 
                     if p_xs is not None and _last_display is not None:
-                        #
-                        # FIXME: this trick is nasty, client implementation should rather cleanly shutdown launch X-server processes
-                        # 
-                        # re-use a left behind X-server instance of a previous/crashed run of Python X2Go Client
-                        self.logger('found a running (and maybe stray) X-server, trying to re-use it on X DISPLAY port: %s' % _last_display, loglevel=log.loglevel_WARN)
-                        os.environ.update({'DISPLAY': str(_last_display)})
+                        if _last_display == _new_display:
+                            #
+                            # FIXME: this trick is nasty, client implementation should rather cleanly shutdown launch X-server processes
+                            #
+                            # re-use a left behind X-server instance of a previous/crashed run of Python X2Go Client
+                            self.logger('found a running (and maybe stray) X-server, trying to re-use it on X DISPLAY port: %s' % _last_display, loglevel=log.loglevel_WARN)
+                            os.environ.update({'DISPLAY': str(_last_display)})
                     else:
                         # presume the running XServer listens on :0
                         self.logger('using fallback display for X-server: localhost:0', loglevel=log.loglevel_WARN)
diff --git a/x2go/xserver.py b/x2go/xserver.py
index 4497bb1..f6d5c55 100644
--- a/x2go/xserver.py
+++ b/x2go/xserver.py
@@ -249,6 +249,9 @@ class X2GoClientXConfig(inifiles.X2GoIniFile):
                 self.update_value(xserver_name, 'parameters', tuple(_parameters))  
                 self.write_user_config = True
                 self.write()
+                return _new_display
+
+            return _last_display
 
         except TypeError:
             pass

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/python-x2go.git



More information about the x2go-commits mailing list