[X2Go-Commits] [x2goserver] 01/01: x2goserver/bin/x2go{resume-session, startagent}: revert error catching while inserting values into database.

git-admin at x2go.org git-admin at x2go.org
Thu Nov 2 19:55:13 CET 2017


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch release/4.0.1.x
in repository x2goserver.

commit 8b363c530f66240d19140962c76dabc237d247c8
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Nov 2 19:51:35 2017 +0100

    x2goserver/bin/x2go{resume-session,startagent}: revert error catching while inserting values into database.
    
    The current code structure relies on ignoring failures and retrying
    until an operation succeeded, which may eventually happen or just as
    well may never happen.
    
    We need something smarter here.
---
 debian/changelog                  |  5 +++++
 x2goserver/bin/x2goresume-session | 18 ++++++++++--------
 x2goserver/bin/x2gostartagent     | 36 ++++++++++++++++++++----------------
 3 files changed, 35 insertions(+), 24 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 499305c..1d6e939 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -64,6 +64,11 @@ x2goserver (4.0.1.21-0x2go1) UNRELEASED; urgency=medium
     - x2goserver/etc/x2goagent.options: remove file, moved to x2goagent.
     - x2goserver/Makefile: actually unreference x2goagent.options file as
       well.
+    - x2goserver/bin/x2go{resume-session,startagent}: revert error catching
+      while inserting values into database. The current code structure relies
+      on ignoring failures and retrying until an operation succeeded, which
+      may eventually happen or just as well may never happen. We need
+      something smarter here.
   * x2goserver.spec:
     - Add mandatory perl-generators Build-Requires as per
       https://fedoraproject.org/wiki/Changes/Build_Root_Without_Perl
diff --git a/x2goserver/bin/x2goresume-session b/x2goserver/bin/x2goresume-session
index 292b09c..c981a7d 100755
--- a/x2goserver/bin/x2goresume-session
+++ b/x2goserver/bin/x2goresume-session
@@ -208,14 +208,16 @@ while [ "$GR_PORT" == "" ] || [ "$SOUND_PORT" == "" ] || [ "$FS_PORT" == "" ]; d
 		if [ "$SERV" == "" ]; then
 			OUTPUT="$("${X2GO_LIB_PATH}/x2goinsertport" "${current_host_name}" "$SESSION_NAME" "$SSH_PORT")"
 
-			if [[ "${?}" -ne "0" ]]; then
-				typeset msg="Unable to insert new port into database; parameters: hostname (${current_host_name}), session name (${SESSION_NAME}) and port (${SSH_PORT})."
-				"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
-
-				# Make x2goclient fail.
-				echo "${msg}" >&2
-				exit 1
-			fi
+			# Catching errors here would be nice, but the current layout doesn't allow this.
+			# Keep this in mind as a FIXME.
+			#if [[ "${?}" -ne "0" ]]; then
+			#	typeset msg="Unable to insert new port into database; parameters: hostname (${current_host_name}), session name (${SESSION_NAME}) and port (${SSH_PORT})."
+			#	"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
+			#
+			#	# Make x2goclient fail.
+			#	echo "${msg}" >&2
+			#	exit 1
+			#fi
 		fi
 	done
 	if [ "$GR_PORT" == "" ]; then
diff --git a/x2goserver/bin/x2gostartagent b/x2goserver/bin/x2gostartagent
index 2275f6b..04bc072 100755
--- a/x2goserver/bin/x2gostartagent
+++ b/x2goserver/bin/x2gostartagent
@@ -335,14 +335,16 @@ while [ "$OUTPUT"  != "inserted" ]; do
 		SESSION_NAME=`echo "$SESSION_NAME" | perl -pe  "s/[^a-zA-Z0-9\.\_\-\@]//g"`
 
 		OUTPUT=`$X2GO_LIB_PATH/x2goinsertsession "$X2GO_PORT" "${current_host_name}" "$SESSION_NAME"`
-		if [[ "${?}" -ne "0" ]]; then
-			typeset msg="Unable to insert new session into database; parameters: port (${X2GO_PORT}), hostname (${current_host_name}) and session name (${SESSION_NAME})."
-			"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
-
-			# Make x2goclient fail.
-			echo "${msg}" >&2
-			exit 1
-		fi
+		# Catching errors here would be nice, but the current layout doesn't allow this.
+		# Keep this in mind as a FIXME.
+		#if [[ "${?}" -ne "0" ]]; then
+		#	typeset msg="Unable to insert new session into database; parameters: port (${X2GO_PORT}), hostname (${current_host_name}) and session name (${SESSION_NAME})."
+		#	"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
+		#
+		#	# Make x2goclient fail.
+		#	echo "${msg}" >&2
+		#	exit 1
+		#fi
 	fi
 done
 
@@ -367,14 +369,16 @@ while [ "$GR_PORT" == "" ] || [ "$SOUND_PORT" == "" ] || [ "$FS_PORT" == "" ]; d
 		if [ "$SERV" == "" ]; then
 			OUTPUT=`$X2GO_LIB_PATH/x2goinsertport "${current_host_name}" "$SESSION_NAME" "$SSH_PORT"`
 
-			if [[ "${?}" -ne "0" ]]; then
-				typeset msg="Unable to insert new port into database; parameters: hostname (${current_host_name}), session name (${SESSION_NAME}) and port (${SSH_PORT})."
-				"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
-
-				# Make x2goclient fail.
-				echo "${msg}" >&2
-				exit 1
-			fi
+			# Catching errors here would be nice, but the current layout doesn't allow this.
+			# Keep this in mind as a FIXME.
+			#if [[ "${?}" -ne "0" ]]; then
+			#	typeset msg="Unable to insert new port into database; parameters: hostname (${current_host_name}), session name (${SESSION_NAME}) and port (${SSH_PORT})."
+			#	"${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}"
+			#
+			#	# Make x2goclient fail.
+			#	echo "${msg}" >&2
+			#	exit 1
+			#fi
 		fi
 	done
 

--
Alioth's /srv/git/code.x2go.org/x2goserver.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list