[X2Go-Commits] python-x2go.git - build-baikal (branch) updated: 0.0.44.2-43-g4ef2323

X2Go dev team git-admin at x2go.org
Wed Jan 8 15:28:30 CET 2014


The branch, build-baikal has been updated
       via  4ef2323698bda18366344ccb6f947055e476bd47 (commit)
      from  314423ef7cff66d3c165b7b5193e14db418807cd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 x2go/client.py   |   19 +++++++++----------
 x2go/registry.py |   10 ++++++----
 x2go/session.py  |    6 ++++--
 3 files changed, 19 insertions(+), 16 deletions(-)

The diff of changes is:
diff --git a/x2go/client.py b/x2go/client.py
index 2d17915..995dc81 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -2121,16 +2121,15 @@ class X2goClient(object):
         @type profile_name: C{str}
 
         """
-        for profile_name in self.client_connected_profiles(return_profile_names=True):
-            session_list = self.list_sessions(profile_name=profile_name, 
-                                              update_sessionregistry=False,
-                                              register_sessions=False,
-                                             )
-            try:
-                self.session_registry.register_available_server_sessions(profile_name, session_list=session_list)
-            except x2go_exceptions.X2goControlSessionException:
-                if self.disconnect_profile(profile_name):
-                    self.HOOK_on_control_session_death(profile_name)
+        session_list = self.list_sessions(profile_name=profile_name, 
+                                          update_sessionregistry=False,
+                                          register_sessions=False,
+                                         )
+        try:
+            self.session_registry.register_available_server_sessions(profile_name, session_list=session_list)
+        except x2go_exceptions.X2goControlSessionException:
+            if self.disconnect_profile(profile_name):
+                self.HOOK_on_control_session_death(profile_name)
     __register_available_server_sessions_by_profile_name = register_available_server_sessions_by_profile_name
 
     def register_available_server_sessions_by_session_uuid(self, session_uuid):
diff --git a/x2go/registry.py b/x2go/registry.py
index e9d3663..7d3ee3b 100644
--- a/x2go/registry.py
+++ b/x2go/registry.py
@@ -179,7 +179,7 @@ class X2goSessionRegistry(object):
             _session_summary['terminated'] = None
         return _session_summary
 
-    def update_status(self, session_uuid=None, profile_name=None, profile_id=None, session_list=None):
+    def update_status(self, session_uuid=None, profile_name=None, profile_id=None, session_list=None, force_update=False):
         """\
         Update the session status for L{X2goSession} that is represented by a given session UUID hash,
         profile name or profile ID.
@@ -195,6 +195,8 @@ class X2goSessionRegistry(object):
         @param session_list: an optional C{X2goServerSessionList*} instance (as returned by the L{X2goClient.list_sessions()} command can
             be passed to this method.
         @type session_list: C{X2goServerSessionList*} instance
+        @param force_update: make sure the session status gets really updated
+        @type force_update: C{bool}
 
         """
         if session_uuid and profile_name or session_uuid and profile_id or profile_name and profile_id:
@@ -211,7 +213,7 @@ class X2goSessionRegistry(object):
 
         for _session_uuid in session_uuids:
 
-            self(_session_uuid).update_status(session_list=session_list)
+            self(_session_uuid).update_status(session_list=session_list, force_update=force_update)
             _last_status = copy.deepcopy(self(_session_uuid)._last_status)
             _current_status = copy.deepcopy(self(_session_uuid)._current_status)
 
@@ -286,7 +288,7 @@ class X2goSessionRegistry(object):
 
             # make sure the session registry gets updated before registering new session
             # (if the server name has changed, this will kick out obsolete X2goSessions)
-            self.update_status(profile_name=profile_name, session_list=session_list)
+            self.update_status(profile_name=profile_name, session_list=session_list, force_update=True)
             for session_name in session_list.keys():
                 if session_name not in _session_names:
                     server = _ctrl_session.get_server_hostname()
@@ -324,7 +326,7 @@ class X2goSessionRegistry(object):
                                                      **kwargs
                                                     )
                         self(session_uuid).connected = True
-                        self.update_status(profile_name=profile_name, session_list=session_list)
+                        self.update_status(profile_name=profile_name, session_list=session_list, force_update=True)
 
     def register(self, server, profile_id, profile_name,
                  session_name=None,
diff --git a/x2go/session.py b/x2go/session.py
index b00a17b..7fc39fb 100644
--- a/x2go/session.py
+++ b/x2go/session.py
@@ -801,7 +801,7 @@ class X2goSession(object):
             return None
     __list_sessions = list_sessions
 
-    def update_status(self, session_list=None):
+    def update_status(self, session_list=None, force_update=False):
         """\
         Update the current session status. The L{X2goSession} instance uses an internal
         session status cache that allows to query the session status without the need
@@ -818,9 +818,11 @@ class X2goSession(object):
         @param session_list: provide an C{X2goServerSessionList*} that refers to X2go sessions we want to update.
             This option is mainly for reducing server/client traffic.
         @type session_list: C{X2goServerSessionList*} instance
+        @param force_update: force a session status update, if if the last update is less then 1 second ago
+        @type force_update: C{bool}
 
         """
-        if self._last_status is not None:
+        if not force_update and self._last_status is not None:
             _status_update_timedelta = time.time() - self._last_status['timestamp']
 
             # skip this session status update if not longer than a second ago...


hooks/post-receive
-- 
python-x2go.git (Python X2Go Client API)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-x2go.git" (Python X2Go Client API).




More information about the x2go-commits mailing list