[X2Go-Commits] x2goserver.git - build-main (branch) updated: 4.0.1.3-2-g15860d2

X2Go dev team git-admin at x2go.org
Sat Jul 27 00:13:36 CEST 2013


The branch, build-main has been updated
       via  15860d2e1e69ae9e5b58e4957aa3efa925410d00 (commit)
      from  74f823a903ad9d83b9ed9ea49d8125c4dff45d1c (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:
 debian/changelog              |    8 ++++++++
 x2goserver/bin/x2gostartagent |   27 +++++++++++++++++++--------
 2 files changed, 27 insertions(+), 8 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 97ab7b3..08d3a39 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+x2goserver (4.0.1.4-0~x2go1) UNRELEASED; urgency=low
+
+  * New upstream versino (4.0.1.4):
+    - Multiply query USED_DISPLAYS and USED_PORTS in x2gostartagent to minimize
+      race conditions in cases where many clients launch session simultaneously.
+
+ -- Mike Gabriel <mike.gabriel at das-netzwertkeam.de>  Fri, 19 Jul 2013 17:53:11 +0200
+
 x2goserver (4.0.1.3-0~x2go1) unstable; urgency=low
 
   * New upstream version (4.0.1.3):
diff --git a/x2goserver/bin/x2gostartagent b/x2goserver/bin/x2gostartagent
index e137368..d25a48a 100755
--- a/x2goserver/bin/x2gostartagent
+++ b/x2goserver/bin/x2gostartagent
@@ -131,17 +131,20 @@ if [ "$X2GO_CLIENT" == "" ]; then
 	X2GO_CLIENT="$HOSTNAME"
 fi
 
-USED_DISPLAYS=`$X2GO_LIB_PATH/x2gogetdisplays $HOSTNAME`
-
-#Get all used in system ports from X2Go database and ss output
+# define the full path to the ss utility
 ss=$(PATH="$PATH:/usr/sbin:/sbin" type -P ss);
-USED_PORTS=$(
-	"$X2GO_LIB_PATH/x2gogetports" "$HOSTNAME";
-	"$ss" -nt -all |
-	awk '{ n=split($0,lines,"\n"); for(i=1;i<=n;i++){split (lines[i],words," ");delim=split(words[4],ports,":"); if(delim>1)printf ("|%s|\n",ports[delim])} }';
-);
 
 while [ "$OUTPUT"  != "inserted" ]; do
+
+	USED_DISPLAYS=`$X2GO_LIB_PATH/x2gogetdisplays $HOSTNAME`
+
+	#Get all used in system ports from X2Go database and ss output
+	USED_PORTS=$(
+	    "$X2GO_LIB_PATH/x2gogetports" "$HOSTNAME";
+	    "$ss" -nt -all |
+	    awk '{ n=split($0,lines,"\n"); for(i=1;i<=n;i++){split (lines[i],words," ");delim=split(words[4],ports,":"); if(delim>1)printf ("|%s|\n",ports[delim])} }';
+	);
+
 	X2GO_PORT=$(($X2GO_PORT + 1))
 	X2GO_PORT=`echo "for(\\$i=$X2GO_PORT;\\$br ne \"true\";\\$i++){ if(\"$USED_DISPLAYS\" =~ m/\\|\\$i\\|/){\\$br=\"false\";}else{\\$br=\"true\";print \\$i;}}"|perl`
 	
@@ -167,6 +170,13 @@ while [ "$GR_PORT" == "" ] || [ "$SOUND_PORT" == "" ] || [ "$FS_PORT" == "" ]; d
 	while [ "$OUTPUT"  != "inserted" ]; do
 		SSH_PORT=$(($SSH_PORT + 1))
 
+		#Get all used in system ports from X2Go database and ss output
+		USED_PORTS=$(
+		    "$X2GO_LIB_PATH/x2gogetports" "$HOSTNAME";
+		    "$ss" -nt -all |
+		    awk '{ n=split($0,lines,"\n"); for(i=1;i<=n;i++){split (lines[i],words," ");delim=split(words[4],ports,":"); if(delim>1)printf ("|%s|\n",ports[delim])} }';
+		);
+
 		#get free port
 		SSH_PORT=`echo "for(\\$i=$SSH_PORT;\\$br ne \"true\";\\$i++){ if(\"$USED_PORTS\" =~ m/\\|\\$i\\|/){\\$br=\"false\";}else{\\$br=\"true\";print \\$i;}}"|perl`
 
@@ -176,6 +186,7 @@ while [ "$GR_PORT" == "" ] || [ "$SOUND_PORT" == "" ] || [ "$FS_PORT" == "" ]; d
 			OUTPUT=`$X2GO_LIB_PATH/x2goinsertport "$HOSTNAME" "$SESSION_NAME" "$SSH_PORT"`
 		fi
 	done
+
 	if [ "$GR_PORT" == "" ]; then
 		GR_PORT="$SSH_PORT"
 	elif [ "$SOUND_PORT" == "" ]; then


hooks/post-receive
-- 
x2goserver.git (X2Go Server)

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 "x2goserver.git" (X2Go Server).




More information about the x2go-commits mailing list