aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Handlers.c
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-06-18 09:27:39 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-06-18 09:27:39 +0200
commit2dd1a1fe6dbbffd764ea0a36743ec7d8e83b2ad6 (patch)
treebc82daeb0090eea8dc7eb977cc82a3ed47284262 /nx-X11/programs/Xserver/hw/nxagent/Handlers.c
parent3dea5a88cad4ee51b2240bb95693ccb4c43047b5 (diff)
parent6051dec4a1ae6decd9123a3310098baf43f45c49 (diff)
downloadnx-libs-2dd1a1fe6dbbffd764ea0a36743ec7d8e83b2ad6.tar.gz
nx-libs-2dd1a1fe6dbbffd764ea0a36743ec7d8e83b2ad6.tar.bz2
nx-libs-2dd1a1fe6dbbffd764ea0a36743ec7d8e83b2ad6.zip
Merge branch 'Ionic-feature/configurablesleep' into 3.6.x
Attributes GH PR #143: https://github.com/ArcticaProject/nx-libs/pull/143
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Handlers.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Handlers.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c
index 1beff090b..ba4034255 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c
@@ -63,14 +63,6 @@
#define FLUSH_AFTER_MULTIPLE_READS
/*
- * Introduce a small delay after each
- * loop if the session is down. The
- * value is in milliseconds.
- */
-
-#define LOOP_DELAY_IF_DOWN 50
-
-/*
* The soft limit should roughly match
* the size of the Xlib I/O buffer.
*/
@@ -246,12 +238,21 @@ void nxagentBlockHandler(void * data, struct timeval **timeout, void * mask)
* not connected to a valid display.
*/
- if (NXDisplayError(nxagentDisplay) == 1 && nxagentShadowCounter == 0)
+ if (NXDisplayError(nxagentDisplay) == 1 && nxagentShadowCounter == 0 && nxagentOption(SleepTime) > 0)
{
- usleep(LOOP_DELAY_IF_DOWN * 1000);
+#ifdef TEST
+ fprintf(stderr, "nxagentBlockHandler: sleeping for %d milliseconds for slowdown.\n",
+ nxagentOption(SleepTime));
+#endif
+ usleep(nxagentOption(SleepTime) * 1000);
now = GetTimeInMillis();
}
+#ifdef TEST
+ else if (0 == nxagentOption(SleepTime)) {
+ fprintf(stderr, "nxagentBlockHandler: not sleeping for slowdown.\n");
+ }
+#endif
/*
* Update the shadow display. This is
@@ -743,9 +744,17 @@ void nxagentShadowBlockHandler(void * data, struct timeval **timeout, void * mas
nxagentHandleConnectionChanges();
}
- if (nxagentSessionState == SESSION_DOWN)
+ if (nxagentSessionState == SESSION_DOWN && nxagentOption(SleepTime) > 0)
{
- usleep(50 * 1000);
+#ifdef TEST
+ fprintf(stderr, "nxagentBlockHandler: sleeping for %d milliseconds for slowdown.\n",
+ nxagentOption(SleepTime));
+#endif
+ usleep(nxagentOption(SleepTime) * 1000);
+ }
+#ifdef TEST
+ else if (0 == nxagentOption(SleepTime)) {
+ fprintf(stderr, "nxagentBlockHandler: not sleeping for slowdown.\n");
}
#ifndef __CYGWIN32__
@@ -826,7 +835,18 @@ FIXME: Must queue multiple writes and handle
#ifdef __CYGWIN32__
- usleep(50 * 1000);
+ if (nxagentOption(SleepTime) > 0) {
+#ifdef TEST
+ fprintf(stderr, "nxagentShadowBlockHandler: sleeping for %d milliseconds for slowdown.\n",
+ nxagentOption(SleepTime));
+#endif
+ usleep(nxagentOption(SleepTime) * 1000);
+ }
+#ifdef TEST
+ else if (0 == nxagentOption(SleepTime)) {
+ fprintf(stderr, "nxagentShadowBlockHandler: not sleeping for slowdown.\n");
+ }
+#endif
(*timeout) -> tv_sec = 0;
(*timeout) -> tv_usec = 50 * 1000;