[X2Go-Commits] [python-x2go] 02/02: X2GoControlSession: Don't mess with the associated_terminals dict if the control session has already died away (i.e. been forcefully disconnect).

git-admin at x2go.org git-admin at x2go.org
Thu Oct 9 05:46: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 9e05ee502903b933d405987f34ef584b47d08dc5
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Oct 9 05:46:35 2014 +0200

    X2GoControlSession: Don't mess with the associated_terminals dict if the control session has already died away (i.e. been forcefully disconnect).
---
 debian/changelog               |    3 +++
 x2go/backends/control/plain.py |   30 ++++++++++++++----------------
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 47e7278..8cdfe2c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -107,6 +107,9 @@ python-x2go (0.5.0.0-0x2go1) UNRELEASED; urgency=low
     - Release _share_local_folder_lock on instance X2GoTerminalSession
       destruction.
     - Detect non-installed sshfs (required for Telekinesis).
+    - X2GoControlSession: Don't mess with the associated_terminals dict if
+      the control session has already died away (i.e. been forcefully
+      disconnect).
   * debian/control:
     + Add dependencies: python-requests, python-simplejson.
     + Add R (python-x2go): sshfs.
diff --git a/x2go/backends/control/plain.py b/x2go/backends/control/plain.py
index 0bd08ff..d678276 100644
--- a/x2go/backends/control/plain.py
+++ b/x2go/backends/control/plain.py
@@ -111,8 +111,6 @@ class X2GoControlSession(paramiko.SSHClient):
     C{paramiko.SSHClient} and adds on X2Go related functionality.
 
     """
-    associated_terminals = None
-
     def __init__(self,
                  profile_name='UNKNOWN',
                  add_to_known_hosts=False,
@@ -1120,7 +1118,7 @@ class X2GoControlSession(paramiko.SSHClient):
         """
         if self.associated_terminals:
             t_names = self.associated_terminals.keys()
-            for  t_obj in self.associated_terminals.values():
+            for t_obj in self.associated_terminals.values():
                 try:
                     if not self.session_died:
                         t_obj.suspend()
@@ -1676,19 +1674,19 @@ class X2GoControlSession(paramiko.SSHClient):
                 raise x2go_exceptions.X2GoControlSessionException('x2golistsessions command failed after we have tried 20 times')
 
             # update internal variables when list_sessions() is called
-            for _session_name, _terminal in self.associated_terminals.items():
-                if _session_name in _listsessions.keys():
-                    # update the whole session_info object within the terminal session
-                    if hasattr(self.associated_terminals[_session_name], 'session_info') and not self.associated_terminals[_session_name].is_session_info_protected():
-                        self.associated_terminals[_session_name].session_info.update(_listsessions[_session_name])
-                else:
-                    try: del self.associated_terminals[_session_name]
-                    except KeyError: pass
-                    self.terminated_terminals.append(_session_name)
-                if _terminal.is_suspended():
-                    try: del self.associated_terminals[_session_name]
-                    except KeyError: pass
-
+            if _success and not self.session_died:
+                for _session_name, _terminal in self.associated_terminals.items():
+                    if _session_name in _listsessions.keys():
+                        # update the whole session_info object within the terminal session
+                        if hasattr(self.associated_terminals[_session_name], 'session_info') and not self.associated_terminals[_session_name].is_session_info_protected():
+                            self.associated_terminals[_session_name].session_info.update(_listsessions[_session_name])
+                    else:
+                        try: del self.associated_terminals[_session_name]
+                        except KeyError: pass
+                        self.terminated_terminals.append(_session_name)
+                    if _terminal.is_suspended():
+                        try: del self.associated_terminals[_session_name]
+                        except KeyError: pass
 
             return _listsessions
 

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