[X2Go-Commits] [python-x2go] 01/03: Handle sudden control session death during local folder sharing

git-admin at x2go.org git-admin at x2go.org
Fri Oct 3 13:12:03 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 5c8d005073567b55533ed88b9c4cf1f02cd94e15
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Oct 3 13:10:25 2014 +0200

    Handle sudden control session death during local folder sharing
---
 debian/changelog |    2 ++
 x2go/session.py  |   34 ++++++++++++++++++++--------------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b082764..3db9b28 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -98,6 +98,8 @@ python-x2go (0.5.0.0-0x2go1) UNRELEASED; urgency=low
       session name (in X2GoTelekinesis).
     - Handle socket errors on the reverse port forwarding tunnels more
       gracefully.
+    - Handle sudden control session death during local folder sharing
+gracefully.
   * debian/control:
     + Add dependencies: python-requests, python-simplejson.
   * python-x2go.spec:
diff --git a/x2go/session.py b/x2go/session.py
index 718c6db..88fc35e 100644
--- a/x2go/session.py
+++ b/x2go/session.py
@@ -2614,21 +2614,27 @@ class X2GoSession(object):
                     self.shared_folders[local_path]['status'] = 'mounted'
                 else:
                     self.shared_folders.update({ local_path: { 'status': 'new', 'mountpoint': '', }, })
-                if self.terminal_session.share_local_folder(local_path=local_path):
-                    if update_exported_folders:
-                        self._update_restore_exported_folders()
-                    retval = True
-                else:
-                    # remove local_path from folder again if the unmounting process failed
-                    if self.shared_folders[local_path]['status'] == 'new':
-                        del self.shared_folders[local_path]
+                try:
+                    if self.terminal_session.share_local_folder(local_path=local_path):
+                        if update_exported_folders:
+                            self._update_restore_exported_folders()
+                        retval = True
                     else:
-                        self.shared_folders[local_path]['status'] = 'unmounted'
-
-                    # disable this local folder in session profile if restoring shared folders for following sessions is activated
-                    if self.client_instance and self.restore_shared_local_folders:
-                        if local_path in self._restore_exported_folders.keys():
-                            self._restore_exported_folders[local_path] = False
+                        # remove local_path from folder again if the unmounting process failed
+                        if self.shared_folders[local_path]['status'] == 'new':
+                            del self.shared_folders[local_path]
+                        else:
+                            self.shared_folders[local_path]['status'] = 'unmounted'
+
+                        # disable this local folder in session profile if restoring shared folders for following sessions is activated
+                        if self.client_instance and self.restore_shared_local_folders:
+                            if local_path in self._restore_exported_folders.keys():
+                                self._restore_exported_folders[local_path] = False
+
+                except x2go_exceptions.X2GoControlSessionException:
+                    if self.connected: self.HOOK_on_control_session_death()
+                    self._X2GoSession__disconnect()
+                    return retval
 
                 # save exported folders to session profile config if requested by session profile parameter ,,restoreexports''...
                 if update_exported_folders and self.client_instance and self.restore_shared_local_folders:

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