Unverified Commit 443b5272 authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'Ionic-feature/reconnect-checks' into 3.6.x

Attributes GH PR #183: https://github.com/ArcticaProject/nx-libs/pull/183 Together with PR #143 this fixes ArcticaProject/nx-libs#132. t merges an updated upstream into a topic branch.
parents e1c85caa 64a83d1e
...@@ -1405,6 +1405,82 @@ static void nxagentParseOptions(char *name, char *value) ...@@ -1405,6 +1405,82 @@ static void nxagentParseOptions(char *name, char *value)
return; 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 else
{ {
#ifdef DEBUG #ifdef DEBUG
......
...@@ -166,6 +166,8 @@ void nxagentInitOptions() ...@@ -166,6 +166,8 @@ void nxagentInitOptions()
nxagentOptions.Xinerama = 1; nxagentOptions.Xinerama = 1;
nxagentOptions.SleepTime = DEFAULT_SLEEP_TIME; nxagentOptions.SleepTime = DEFAULT_SLEEP_TIME;
nxagentOptions.ReconnectTolerance = DEFAULT_TOLERANCE;
} }
/* /*
......
...@@ -67,6 +67,17 @@ typedef enum _ClientOsType ...@@ -67,6 +67,17 @@ typedef enum _ClientOsType
} ClientOsType; } ClientOsType;
typedef enum _ToleranceChecksMode
{
ToleranceChecksStrict = 0,
ToleranceChecksSafe = 1,
ToleranceChecksRisky = 2,
ToleranceChecksBypass = 3
} ToleranceChecksMode;
#define DEFAULT_TOLERANCE ToleranceChecksStrict
/* /*
* Set of options affecting agent operations. * Set of options affecting agent operations.
*/ */
...@@ -414,6 +425,12 @@ typedef struct _AgentOptions ...@@ -414,6 +425,12 @@ typedef struct _AgentOptions
unsigned int SleepTime; unsigned int SleepTime;
/*
* Tolerance - tightens or loosens reconnect checks.
*/
ToleranceChecksMode ReconnectTolerance;
} AgentOptionsRec; } AgentOptionsRec;
typedef AgentOptionsRec *AgentOptionsPtr; typedef AgentOptionsRec *AgentOptionsPtr;
......
...@@ -9063,7 +9063,8 @@ int ParseEnvironmentOptions(const char *env, int force) ...@@ -9063,7 +9063,8 @@ int ParseEnvironmentOptions(const char *env, int force)
strcasecmp(name, "clipboard") == 0 || strcasecmp(name, "clipboard") == 0 ||
strcasecmp(name, "streaming") == 0 || strcasecmp(name, "streaming") == 0 ||
strcasecmp(name, "backingstore") == 0 || strcasecmp(name, "backingstore") == 0 ||
strcasecmp(name, "sleep") == 0) strcasecmp(name, "sleep") == 0 ||
strcasecmp(name, "tolerancechecks") == 0)
{ {
#ifdef DEBUG #ifdef DEBUG
*logofs << "Loop: Ignoring agent option '" << name *logofs << "Loop: Ignoring agent option '" << name
......
...@@ -325,7 +325,9 @@ shadowmode=s\n\ ...@@ -325,7 +325,9 @@ shadowmode=s\n\
defer=n\n\ defer=n\n\
tile=s\n\ tile=s\n\
menu=n\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\ are ignored by the proxy.\n\
\n\ \n\
Environment:\n\ Environment:\n\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment