[X2Go-Commits] x2gobroker.git - statusflag (branch) updated: 0.0.2.2-17-g48d4d77

X2Go dev team git-admin at x2go.org
Tue Jun 4 22:23:08 CEST 2013


The branch, statusflag has been updated
       via  48d4d7724e7214bf5c673926cd7836340a18af7a (commit)
      from  70b42c517cfe898af2fab2c06fbedb625c3909d2 (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 -----------------------------------------------------------------
commit 48d4d7724e7214bf5c673926cd7836340a18af7a
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Tue Jun 4 22:23:06 2013 +0200

    resume suspended/running sessions also in non-loadbalancing-mode

-----------------------------------------------------------------------

Summary of changes:
 x2gobroker/brokers/base_broker.py |   20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

The diff of changes is:
diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py
index 446fb69..4788517 100644
--- a/x2gobroker/brokers/base_broker.py
+++ b/x2gobroker/brokers/base_broker.py
@@ -952,16 +952,28 @@ class X2GoBroker(object):
             'port': profile[u'sshport'],
         }
 
-        # find already running sessions and resume the first one found
-        if remote_agent and len(server_list) >= 2 and username:
+        # find already running/suspended sessions and resume the first one found
+        if remote_agent and server_list and username:
 
             session_list = x2gobroker.agent.list_sessions(username=username, query_mode=agent_query_mode, remote_agent=remote_agent)
             if session_list:
 
                 # if resuming, always select the first session in the list, there should only be one suspended session
                 try:
-                    server_name = session_list[0].split('|')[3]
-                    session_info = session_list[0]
+                    running_sessions = []
+                    suspended_sessions = []
+                    for session_info in session_list:
+                        if session.split('|')[4] == 'R':
+                            running_sessions.append(session_info)
+                        if session.split('|')[4] == 'S':
+                            suspended_sessions.append(session_info)
+
+                    # we prefer suspended sessions for resuming if we find sessions with both states of activity
+                    if suspended_sessions:
+                        session_info = suspended_sessions[0]
+                    else:
+                        session_info = running_sessions[0]
+                    server_name = session_info.split('|')[3]
 
                     # if we have an explicit IP address for server_name, let's use that instead...
                     try:


hooks/post-receive
-- 
x2gobroker.git (HTTP(S) Session broker for X2Go)

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 "x2gobroker.git" (HTTP(S) Session broker for X2Go).




More information about the x2go-commits mailing list