[X2Go-Commits] [x2goclient] 04/04: {src/{onmainwindow.{cpp, h}, help.cpp}, man/man1/x2goclient.1}: add new option --xserver-start-limit, replacing the formerly hardcoded limit of three tries.
git-admin at x2go.org
git-admin at x2go.org
Sat May 12 00:38:13 CEST 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2goclient.
commit 94b93f57c643a4660822831c54390d40d40240a4
Author: Mihai Moldovan <ionic at ionic.de>
Date: Sat May 12 00:31:19 2018 +0200
{src/{onmainwindow.{cpp,h},help.cpp},man/man1/x2goclient.1}: add new option --xserver-start-limit, replacing the formerly hardcoded limit of three tries.
---
debian/changelog | 3 +++
man/man1/x2goclient.1 | 8 ++++++++
src/help.cpp | 5 +++++
src/onmainwindow.cpp | 38 ++++++++++++++++++++++++++++++++++----
src/onmainwindow.h | 1 +
5 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index cfcbac6..e030e15 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -57,6 +57,9 @@ x2goclient (4.1.2.0-0x2go1) UNRELEASED; urgency=medium
check if the server binary actually is still alive before doing the TCP
connection checks. A dead server won't be able to listen on a socket in
the first place.
+ - {src/{onmainwindow.{cpp,h},help.cpp},man/man1/x2goclient.1}: add new
+ option --xserver-start-limit, replacing the formerly hardcoded limit of
+ three tries.
* x2goclient.spec:
- Remove plugin references.
* debian/rules:
diff --git a/man/man1/x2goclient.1 b/man/man1/x2goclient.1
index 5c566e7..bf2360c 100644
--- a/man/man1/x2goclient.1
+++ b/man/man1/x2goclient.1
@@ -102,6 +102,14 @@ If a directory is given, will randomly pick an SVG file inside of it.
\*(T<\fB\-\-branding=<svg\-file>\fR\*(T>
Use a custom icon (SVG format) for additional branding to replace the default in the lower left corner of X2Go Client's main window.
+.SH MISCELLANEOUS OPTIONS
+These options change X2Go Client's behavior globally. Some might not be available on all platforms.
+.TP
+\*(T<\fB\-\-xserver-start-limit=<num>\fR\*(T> (Windows-only)
+Limit the X.Org Server start count to at most <num> tries. Default: \fB3\fR.
+If \fB<num>\fR is zero or a negative number, no limit is imposed.
+The limits for \fB<num>\fR are platform dependent. If the passed value is out of bounds, X2Go Client falls back to the default value.
+
.SH SESSION PROFILE DEFAULTS
You can set certain defaults for session profiles via command line switches using the following options:
.TP
diff --git a/src/help.cpp b/src/help.cpp
index d5343e8..cec2a40 100644
--- a/src/help.cpp
+++ b/src/help.cpp
@@ -162,6 +162,11 @@ help::params_t help::build_params () {
ADD_OPT ("--broker-logoutbt", QT_TRANSLATE_NOOP ("Help", "Enables broker logout button."));
ADD_OPT ("--background=<svg-file|dir>", QT_TRANSLATE_NOOP ("Help", "Use a custom/branded background image (SVG format) for X2Go Client's main window. If a directory is given, will randomly pick an SVG file inside of it."));
ADD_OPT ("--branding=<svg-file>", QT_TRANSLATE_NOOP ("Help", "Use a custom icon (SVG format) for additional branding to replace the default in the lower left corner of X2Go Client's main window."));
+#if defined (Q_OS_WIN)
+ ADD_OPT ("--xserver-start-limit=<num>", QT_TRANSLATE_NOOP ("Help", "Limit the X.Org Server start count to at most <num> tries. Default: \"3\"." NEWLINE
+ "If <num> is zero or a negative number, no limit is imposed." NEWLINE
+ "The limits for <num> are platform dependent. If the passed value is out of bounds, X2Go Client falls back to the default value."));
+#endif /* defined (Q_OS_WIN) */
# undef NEWLINE
# undef ADD_OPT
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index 0e4e18b..0b6ec1f 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -172,6 +172,7 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent )
xorg=0l;
xDisplay=0;
x_start_tries_ = 0;
+ x_start_limit_ = 3;
#endif
if(X2goSettings::centralSettings())
@@ -7667,6 +7668,30 @@ bool ONMainWindow::parseParameter ( QString param )
OnFile=value;
return true;
}
+#if defined(Q_OS_WIN)
+ if ("--xserver-start-limit" == setting) {
+ bool conv_ret = false;
+ signed long long conv = value.toLongLong (&conv_ret);
+
+ if (conv_ret) {
+ if (0 >= conv) {
+ x2goDebug << "Not limiting X.Org Server starts.";
+
+ x_start_limit_ = -1;
+ {
+ else {
+ x_start_limit = conv;
+
+ x2goDebug << "Limiting X.Org Server starts to " << x_start_limit << " tries.";
+ }
+ }
+ else {
+ x2goDebug << "Conversion for --xserver-start-limit value " << value << " failed; assuming default of 3.";
+
+ x_start_limit = 3;
+ }
+ }
+#endif /* defined(Q_OS_WIN) */
printError ( param );
return false;
@@ -10062,6 +10087,11 @@ void ONMainWindow::startXOrg (std::size_t start_offset)
//check connection in slot and launch setWinServerReady
waitingForX=0;
x_start_tries_ += 1;
+
+ if (0 == x_start_limit_) {
+ x2goWarningf(9) << "X.Org Server start limit set to invalid value zero!";
+ }
+
QTimer::singleShot(1000, this, SLOT(slotCheckXOrgConnection()));
}
// #endif
@@ -10077,8 +10107,8 @@ void ONMainWindow::slotCheckXOrgConnection()
* Process died (crashed, terminated, whatever). We need to restart it, unless we already tried
* to do so multiple times unsuccessfully.
*/
- if (3 < x_start_tries_) {
- x2goDebug << "Unable to start X.Org Server for three times, terminating.";
+ if (x_start_limit_ < x_start_tries_) {
+ x2goDebug << "Unable to start X.Org Server for " << x_start_limit_ << " times, terminating.";
QMessageBox::critical (NULL, QString::null,
tr ("X.Org Server did not launch correctly after three tries.\n"
@@ -10110,11 +10140,11 @@ void ONMainWindow::slotCheckXOrgConnection()
if (waitingForX > 10)
{
/*
- * Timeout reached. If we tried starting the X.Org Server less than three times,
+ * Timeout reached. If we tried starting the X.Org Server less times than the limit,
* continue doing so (with a higher DISPLAY value).
* Otherwise error out.
*/
- if (3 >= x_start_tries_) {
+ if (x_start_limit_ >= x_start_tries_) {
/*
* Server might still be running here, but deleting the QProcess object
* should kill it.
diff --git a/src/onmainwindow.h b/src/onmainwindow.h
index d979c75..dad4f1f 100644
--- a/src/onmainwindow.h
+++ b/src/onmainwindow.h
@@ -877,6 +877,7 @@ private:
QString xorgHeight;
int waitingForX;
std::size_t x_start_tries_;
+ std::ssize_t x_start_limit_;
QRect dispGeometry;
#endif
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list