Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
bf0861aa
You need to sign in or sign up before continuing.
Commit
bf0861aa
authored
Jun 02, 2020
by
Ulrich Sibiller
Committed by
Mike Gabriel
Jun 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nxagent: clarify sleep time units
No functional changes, just clarification/explanation of the existing code. Fixes ArcticaProject/nx-libs#926
parent
4213bf46
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
15 deletions
+27
-15
Args.c
nx-X11/programs/Xserver/hw/nxagent/Args.c
+1
-1
Handlers.c
nx-X11/programs/Xserver/hw/nxagent/Handlers.c
+8
-8
Image.c
nx-X11/programs/Xserver/hw/nxagent/Image.c
+12
-2
Options.c
nx-X11/programs/Xserver/hw/nxagent/Options.c
+1
-1
Options.h
nx-X11/programs/Xserver/hw/nxagent/Options.h
+5
-3
No files found.
nx-X11/programs/Xserver/hw/nxagent/Args.c
View file @
bf0861aa
...
...
@@ -1365,7 +1365,7 @@ static void nxagentParseSingleOption(char *name, char *value)
validateString
(
value
),
validateString
(
name
),
sleep_parse
);
}
nxagentChangeOption
(
SleepTime
,
sleep_parse
);
nxagentChangeOption
(
SleepTime
Millis
,
sleep_parse
);
return
;
}
else
if
(
!
strcmp
(
name
,
"tolerancechecks"
))
...
...
nx-X11/programs/Xserver/hw/nxagent/Handlers.c
View file @
bf0861aa
...
...
@@ -235,18 +235,18 @@ void nxagentBlockHandler(void * data, struct timeval **timeout, void * mask)
* display.
*/
if
(
NXDisplayError
(
nxagentDisplay
)
==
1
&&
nxagentShadowCounter
==
0
&&
nxagentOption
(
SleepTime
)
>
0
)
if
(
NXDisplayError
(
nxagentDisplay
)
==
1
&&
nxagentShadowCounter
==
0
&&
nxagentOption
(
SleepTime
Millis
)
>
0
)
{
#ifdef TEST
fprintf
(
stderr
,
"nxagentBlockHandler: sleeping for %d milliseconds for slowdown.
\n
"
,
nxagentOption
(
SleepTime
));
nxagentOption
(
SleepTime
Millis
));
#endif
usleep
(
nxagentOption
(
SleepTime
)
*
1000
);
usleep
(
nxagentOption
(
SleepTime
Millis
)
*
1000
);
now
=
GetTimeInMillis
();
}
#ifdef TEST
else
if
(
0
==
nxagentOption
(
SleepTime
))
{
else
if
(
0
==
nxagentOption
(
SleepTime
Millis
))
{
fprintf
(
stderr
,
"nxagentBlockHandler: not sleeping for slowdown.
\n
"
);
}
#endif
...
...
@@ -708,16 +708,16 @@ void nxagentShadowBlockHandler(void * data, struct timeval **timeout, void * mas
nxagentHandleConnectionChanges
();
}
if
(
nxagentSessionState
==
SESSION_DOWN
&&
nxagentOption
(
SleepTime
)
>
0
)
if
(
nxagentSessionState
==
SESSION_DOWN
&&
nxagentOption
(
SleepTime
Millis
)
>
0
)
{
#ifdef TEST
fprintf
(
stderr
,
"nxagentShadowBlockHandler: sleeping for %d milliseconds for slowdown.
\n
"
,
nxagentOption
(
SleepTime
));
nxagentOption
(
SleepTime
Millis
));
#endif
usleep
(
nxagentOption
(
SleepTime
)
*
1000
);
usleep
(
nxagentOption
(
SleepTime
Millis
)
*
1000
);
}
#ifdef TEST
else
if
(
0
==
nxagentOption
(
SleepTime
))
{
else
if
(
0
==
nxagentOption
(
SleepTime
Millis
))
{
fprintf
(
stderr
,
"nxagentShadowBlockHandler: not sleeping for slowdown.
\n
"
);
}
#endif
...
...
nx-X11/programs/Xserver/hw/nxagent/Image.c
View file @
bf0861aa
...
...
@@ -492,9 +492,19 @@ void nxagentPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
if
(
nxagentShadowCounter
==
0
&&
NXDisplayError
(
nxagentDisplay
)
==
1
&&
nxagentOption
(
SleepTime
)
>
0
)
nxagentOption
(
SleepTime
Millis
)
>
0
)
{
int
us
=
nxagentOption
(
SleepTime
)
*
4
*
(
length
/
1024
);
/*
* The original NX code had 250us (microseconds) * length/1024
* here and 50ms (milliseconds) elsewhere. Later ONE combined
* configurable sleep parameter was introduced, having a default
* of 50ms (that's milliseconds, not microseconds!), which is
* factor 200. For unknown reasons the factor was changed to 250
* at the same time. Ensure the value is somewhere between 10ms
* and 1s.
*/
int
us
=
nxagentOption
(
SleepTimeMillis
)
*
1000
*
(
length
/
1024
)
/
250
;
us
=
(
us
<
10000
?
10000
:
(
us
>
1000000
?
1000000
:
us
));
...
...
nx-X11/programs/Xserver/hw/nxagent/Options.c
View file @
bf0861aa
...
...
@@ -157,7 +157,7 @@ void nxagentInitOptions(void)
nxagentOptions
.
Xinerama
=
1
;
nxagentOptions
.
SleepTime
=
DEFAULT_SLEEP_TIME
;
nxagentOptions
.
SleepTime
Millis
=
DEFAULT_SLEEP_TIME_MILLIS
;
nxagentOptions
.
ReconnectTolerance
=
DEFAULT_TOLERANCE
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Options.h
View file @
bf0861aa
...
...
@@ -36,7 +36,9 @@
#define UNDEFINED -1
#define COPY_UNLIMITED -1
#define DEFAULT_SLEEP_TIME 50
/* in milliseconds */
#define DEFAULT_SLEEP_TIME_MILLIS 50
extern
unsigned
int
nxagentPrintGeometryFlags
;
...
...
@@ -366,9 +368,9 @@ typedef struct _AgentOptions
int
Xinerama
;
/*
* Sleep delay in mi
cro
seconds.
* Sleep delay in mi
lli
seconds.
*/
unsigned
int
SleepTime
;
unsigned
int
SleepTime
Millis
;
/*
* Tolerance - tightens or loosens reconnect checks.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment