[X2Go-Commits] [live-build-x2go] 135/167: added trickle package, to limit bandwidth usage; added bandwidth throttling code: single throttle value limits upstream; if multiple values are specified, first is upstream, second is downstream

git-admin at x2go.org git-admin at x2go.org
Sat Nov 18 00:32:57 CET 2017


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

x2go pushed a commit to branch feature/openbox-magic-pixel-workaround
in repository live-build-x2go.

commit fe5a07e1a29800053a1611763b1fefce8691c4f5
Author: Stefan Baur <kontakt at baur-itcs.de>
Date:   Mon Oct 30 10:54:15 2017 +0100

    added trickle package, to limit bandwidth usage; added bandwidth throttling code: single throttle value limits upstream; if multiple values are specified, first is upstream, second is downstream
---
 .../lib/live/config/2900-x2go-thinclientconfig     | 26 +++++++++++++++++++++-
 config/package-lists/utils.list.chroot             |  1 +
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig b/config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig
index e5dbdbe..17df60a 100755
--- a/config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig
+++ b/config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig
@@ -180,7 +180,31 @@ if [ -n "\$BLANKINGTIME" ]; then
 	fi
 fi
 
-eval x2goclient --thinclient --no-session-edit --no-menu --maximize --add-to-known-hosts --haltbt --read-exports-from=/home/user/export \$LDAPPARAMS \$SESSIONFROM \$BACKGROUND \$BRANDING \$STARTSESSION
+THROTTLINGCOMMAND=""
+THROTTLEVALUES=\$(sed -e 's/ \([^ ]*\)=/\n\1=/g' -e 's/\([^=]["'"'"']\) /\1\n/g' /proc/cmdline | awk -F '=' '\$1 == "throttle" { print \$2 }' | tr -dc '0-9.:')
+if [ -n "\$THROTTLEVALUES" ]; then
+	THROTTLEARR=(\$(echo \$THROTTLEVALUES | awk -F ':' '\$1 ~/^[0-9\.]*\$/ && \$2 ~/^[0-9\.]*\$/ && \$3 ~/^[0-9\.]*\$/ && \$4 ~/^[0-9\.]*\$/ && \$4 ~/^[0-9\.]*\$/ { print \$1 " " \$2 " " \$3 " " \$4 " " \$5}'))
+	if [ -n "\${THROTTLEARR[4]}" ]; then
+		THROTTLELATENCY="-L \${THROTTLEARR[4]}"
+	fi
+	if [ -n "\${THROTTLEARR[3]}" ]; then
+		THROTTLELENGTH="-l \${THROTTLEARR[3]}"
+	fi
+	if [ -n "\${THROTTLEARR[2]}" ]; then
+		THROTTLETIME="-t \${THROTTLEARR[2]}"
+	fi
+	if [ -n "\${THROTTLEARR[1]}" ]; then
+		THROTTLEDOWN="-d \${THROTTLEARR[1]}"
+	fi
+	if [ -n "\${THROTTLEARR[0]}" ]; then
+		THROTTLEUP="-u \${THROTTLEARR[0]}"
+		THROTTLINGCOMMAND="trickle -s \$THROTTLEDOWN \$THROTTLEUP \$THROTTLETIME \$THROTTLELENGTH \$THROTTLELATENCY"
+	fi
+# only set THROTTLINGCOMMAND if at least one value was detected and sanitized properly
+fi
+
+
+eval \$THROTTLINGCOMMAND x2goclient --thinclient --no-session-edit --no-menu --maximize --add-to-known-hosts --haltbt --read-exports-from=/home/user/export \$LDAPPARAMS \$SESSIONFROM \$BACKGROUND \$BRANDING \$STARTSESSION
 XSESSION
 
 chown user:user /home/user/.xsession
diff --git a/config/package-lists/utils.list.chroot b/config/package-lists/utils.list.chroot
index 930954e..be4701c 100644
--- a/config/package-lists/utils.list.chroot
+++ b/config/package-lists/utils.list.chroot
@@ -11,6 +11,7 @@ openssl
 psmisc 
 rsync 
 screen 
+trickle
 util-linux
 vim 
 wget

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


More information about the x2go-commits mailing list