[X2Go-Commits] [python-x2go] 02/04: Clean up terminal sessions properly when the clean_sessions() method of the control session has got called.

git-admin at x2go.org git-admin at x2go.org
Fri Sep 5 15:20:01 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 a40d73f91b45f07130112b6c1aa1e22186d5fb5f
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Sep 5 15:17:39 2014 +0200

    Clean up terminal sessions properly when the clean_sessions() method of the control session has got called.
---
 debian/changelog               |    2 ++
 x2go/backends/control/plain.py |   19 ++++++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 823dec0..f5857ed 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -85,6 +85,8 @@ python-x2go (0.5.0.0-0x2go1) UNRELEASED; urgency=low
     - For reverse port forwardings use IPv4 localhost address only.
     - Assure proper Telekinesis client cleanup when sessions suspends/
       terminates.
+    - Clean up terminal sessions properly when the clean_sessions() method
+      of the control session has got called.
   * debian/control:
     + Add dependencies: python-requests, python-simplejson.
   * python-x2go.spec:
diff --git a/x2go/backends/control/plain.py b/x2go/backends/control/plain.py
index 5409198..70f5ca2 100644
--- a/x2go/backends/control/plain.py
+++ b/x2go/backends/control/plain.py
@@ -1706,7 +1706,15 @@ class X2GoControlSession(paramiko.SSHClient):
         else:
             session_names = [ _sn for _sn in session_list.keys() if not session_list[_sn].is_published_applications_provider() ]
         for session_name in session_names:
-            self.terminate(session_name=session_name, destroy_terminals=destroy_terminals)
+            if self.associated_terminals.has_key(session_name):
+                self.associated_terminals[session_name].terminate()
+                if destroy_terminals:
+                    if self.associated_terminals[session_name] is not None:
+                        self.associated_terminals[session_name].__del__()
+                    try: del self.associated_terminals[session_name]
+                    except KeyError: pass
+            else:
+                self.terminate(session_name=session_name)
 
     def is_connected(self):
         """\
@@ -1824,18 +1832,19 @@ class X2GoControlSession(paramiko.SSHClient):
         """
 
         _ret = False
-        _session_names = [ t.get_session_name() for t in self.associated_terminals.values() ]
-        if session_name in _session_names:
+        if session_name in self.associated_terminals.keys():
 
             self.logger('terminating associated session: %s' % session_name, loglevel=log.loglevel_DEBUG)
             (stdin, stdout, stderr) = self._x2go_exec_command("x2goterminate-session %s" % session_name, loglevel=log.loglevel_DEBUG)
             stdout.read()
             stderr.read()
-            if self.associated_terminals.has_key(session_name):
-                if self.associated_terminals[session_name] is not None and destroy_terminals:
+
+            if destroy_terminals:
+                if self.associated_terminals[session_name] is not None:
                     self.associated_terminals[session_name].__del__()
                 try: del self.associated_terminals[session_name]
                 except KeyError: pass
+
             self.terminated_terminals.append(session_name)
             _ret = True
 

--
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