aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Args.c76
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Options.c2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Options.h17
-rw-r--r--nxcomp/Loop.cpp3
-rw-r--r--nxcomp/Misc.cpp4
5 files changed, 100 insertions, 2 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index 832595786..9e54c0073 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -1405,6 +1405,82 @@ static void nxagentParseOptions(char *name, char *value)
return;
}
+ else if (!strcmp(name, "tolerancechecks"))
+ {
+ if (strcmp(value, "strict") == 0)
+ {
+ nxagentChangeOption(ReconnectTolerance, ToleranceChecksStrict);
+ }
+ else if (strcmp(value, "safe") == 0)
+ {
+ nxagentChangeOption(ReconnectTolerance, ToleranceChecksSafe);
+ }
+ else if (strcmp(value, "risky") == 0)
+ {
+ nxagentChangeOption(ReconnectTolerance, ToleranceChecksRisky);
+ }
+ else if (strcmp(value, "none") == 0)
+ {
+ nxagentChangeOption(ReconnectTolerance, ToleranceChecksBypass);
+ }
+ else
+ {
+ /*
+ * Check for a matching integer. Or any integer, really.
+ */
+ long tolerance_parse = 0;
+
+ errno = 0;
+ tolerance_parse = strtol(value, NULL, 10);
+
+ if ((errno) && (0 == tolerance_parse))
+ {
+ fprintf(stderr, "nxagentParseOptions: Unable to convert value [%s] of option [%s]. "
+ "Ignoring option.\n",
+ validateString(value), validateString(name));
+
+ return;
+ }
+
+ if ((long) UINT_MAX < tolerance_parse)
+ {
+ tolerance_parse = UINT_MAX;
+
+ fprintf(stderr, "nxagentParseOptions: Warning: value [%s] of option [%s] "
+ "out of range, clamped to [%u].\n",
+ validateString(value), validateString(name), tolerance_parse);
+ }
+
+ if (0 > tolerance_parse)
+ {
+ tolerance_parse = 0;
+
+ fprintf(stderr, "nxagentParseOptions: Warning: value [%s] of option [%s] "
+ "out of range, clamped to [%u].\n",
+ validateString(value), validateString(name), tolerance_parse);
+ }
+
+ #ifdef TEST
+ switch (tolerance_parse) {
+ case ToleranceChecksStrict:
+ case ToleranceChecksSafe:
+ case ToleranceChecksRisky:
+ case ToleranceChecksBypass:
+ break;
+ default:
+ fprintf(stderr, "nxagentParseOptions: Warning: value [%s] of "
+ "option [%s] unknown, will be mapped to "
+ "\"Bypass\" [%u] value internally.\n",
+ validateString(value), validateString(name),
+ (unsigned int)ToleranceChecksBypass);
+ }
+ #endif
+
+ nxagentChangeOption(ReconnectTolerance, tolerance_parse);
+ }
+
+ return;
+ }
else
{
#ifdef DEBUG
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.c b/nx-X11/programs/Xserver/hw/nxagent/Options.c
index 0a894f9a4..978f3ab95 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Options.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Options.c
@@ -166,6 +166,8 @@ void nxagentInitOptions()
nxagentOptions.Xinerama = 1;
nxagentOptions.SleepTime = DEFAULT_SLEEP_TIME;
+
+ nxagentOptions.ReconnectTolerance = DEFAULT_TOLERANCE;
}
/*
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.h b/nx-X11/programs/Xserver/hw/nxagent/Options.h
index df6f8b65b..20616a90b 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Options.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Options.h
@@ -67,6 +67,17 @@ typedef enum _ClientOsType
} ClientOsType;
+typedef enum _ToleranceChecksMode
+{
+ ToleranceChecksStrict = 0,
+ ToleranceChecksSafe = 1,
+ ToleranceChecksRisky = 2,
+ ToleranceChecksBypass = 3
+} ToleranceChecksMode;
+
+
+#define DEFAULT_TOLERANCE ToleranceChecksStrict
+
/*
* Set of options affecting agent operations.
*/
@@ -414,6 +425,12 @@ typedef struct _AgentOptions
unsigned int SleepTime;
+ /*
+ * Tolerance - tightens or loosens reconnect checks.
+ */
+
+ ToleranceChecksMode ReconnectTolerance;
+
} AgentOptionsRec;
typedef AgentOptionsRec *AgentOptionsPtr;
diff --git a/nxcomp/Loop.cpp b/nxcomp/Loop.cpp
index c0951ee19..10026967a 100644
--- a/nxcomp/Loop.cpp
+++ b/nxcomp/Loop.cpp
@@ -9063,7 +9063,8 @@ int ParseEnvironmentOptions(const char *env, int force)
strcasecmp(name, "clipboard") == 0 ||
strcasecmp(name, "streaming") == 0 ||
strcasecmp(name, "backingstore") == 0 ||
- strcasecmp(name, "sleep") == 0)
+ strcasecmp(name, "sleep") == 0 ||
+ strcasecmp(name, "tolerancechecks") == 0)
{
#ifdef DEBUG
*logofs << "Loop: Ignoring agent option '" << name
diff --git a/nxcomp/Misc.cpp b/nxcomp/Misc.cpp
index ca062ebed..c94dc8b9c 100644
--- a/nxcomp/Misc.cpp
+++ b/nxcomp/Misc.cpp
@@ -325,7 +325,9 @@ shadowmode=s\n\
defer=n\n\
tile=s\n\
menu=n\n\
-sleep=n These options are interpreted by the NX agent. They\n\
+sleep=n\n\
+tolerancecehcks=s\n\
+ These options are interpreted by the NX agent. They\n\
are ignored by the proxy.\n\
\n\
Environment:\n\