Commit 92ac0d27 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

WaitFor.c Implement the intended NX_WAKEUP functionality

NX_WAKEUP had been non-effective and its effect had been tied to NX_TRANS_WAKEUP.
parent d282724c
...@@ -202,8 +202,8 @@ INCLUDES = \ ...@@ -202,8 +202,8 @@ INCLUDES = \
# NXAGENT_ONSTART communicate about startup phase to the original nxclient by NoMachine via selections # NXAGENT_ONSTART communicate about startup phase to the original nxclient by NoMachine via selections
# NXAGENT_WAKEUP=<milliseconds> Specifies a timeout that makes WaitForSomething() return earlier than normal which # NXAGENT_WAKEUP=<milliseconds> Specifies a timeout that makes WaitForSomething() return earlier than normal which
# enables nxagent to close the splash window at the right time and/or improve connection # enables nxagent to close the splash window at the right time and/or improve connection
# handling for the xdmcp option. This value has no effect because the code uses # handling for the xdmcp option.
# NX_TRANS_WAKEUP in os/WaitFor.c instead. # This only has an effect if NX_TRANS_WAKEUP is also set for os/WaitFor.c
# NXAGENT_ARTSD enable special handling of MCOPGLOBALS property used by artsd. # NXAGENT_ARTSD enable special handling of MCOPGLOBALS property used by artsd.
# NXAGENT_RENDER_CLEANUP cleanup padding bits/bytes of glyphs to possibly increase compression rate # NXAGENT_RENDER_CLEANUP cleanup padding bits/bytes of glyphs to possibly increase compression rate
# #
......
...@@ -42,7 +42,7 @@ NX_DEFINES = -DNX_TRANS_SOCKET \ ...@@ -42,7 +42,7 @@ NX_DEFINES = -DNX_TRANS_SOCKET \
-DNX_TRANS_FOPEN \ -DNX_TRANS_FOPEN \
-DNX_TRANS_SLEEP \ -DNX_TRANS_SLEEP \
-DNX_TRANS_EXIT \ -DNX_TRANS_EXIT \
-DNX_TRANS_WAKEUP=1000 \ -DNX_TRANS_WAKEUP \
-DNXAGENT_SERVER \ -DNXAGENT_SERVER \
$(NULL) $(NULL)
......
...@@ -237,13 +237,15 @@ WaitForSomething(int *pClientsReady) ...@@ -237,13 +237,15 @@ WaitForSomething(int *pClientsReady)
/* /*
* If caller has marked the first element of pClientsReady[], * If caller has marked the first element of pClientsReady[],
* bail out of select after a short (NX_TRANS_WAKEUP) * bail out of select after the timeout given in the second
* timeout. We need this to let the NX agent remove the splash * element. We need this to let the NX agent remove the splash
* screen when the timeout is expired. A better option would * screen when the timeout is expired even if there's no
* be to use the existing screen-saver timeout but it can be * client. Otherwise WaitForSomething would block. A better
* modified by clients, so we would need a special * option would be to use the existing screen-saver timeout
* handling. This hack is trivial and keeps WaitForSomething() * but it can be modified by clients, so we would need a
* backward compatible with the existing servers. * special handling. This hack is trivial and keeps
* WaitForSomething() backward compatible with the existing
* servers.
*/ */
if (pClientsReady[0] == -1) if (pClientsReady[0] == -1)
...@@ -257,7 +259,7 @@ WaitForSomething(int *pClientsReady) ...@@ -257,7 +259,7 @@ WaitForSomething(int *pClientsReady)
timeoutInMillis = GetTimeInMillis(); timeoutInMillis = GetTimeInMillis();
if (timeoutInMillis - startTimeInMillis >= NX_TRANS_WAKEUP) if (timeoutInMillis - startTimeInMillis >= pClientsReady[1])
{ {
#ifdef NX_TRANS_DEBUG #ifdef NX_TRANS_DEBUG
fprintf(stderr, "WaitForSomething: Returning 0 because of wakeup timeout.\n"); fprintf(stderr, "WaitForSomething: Returning 0 because of wakeup timeout.\n");
...@@ -265,7 +267,7 @@ WaitForSomething(int *pClientsReady) ...@@ -265,7 +267,7 @@ WaitForSomething(int *pClientsReady)
return 0; return 0;
} }
timeoutInMillis = NX_TRANS_WAKEUP - (timeoutInMillis - startTimeInMillis); timeoutInMillis = pClientsReady[1] - (timeoutInMillis - startTimeInMillis);
#ifdef NX_TRANS_DEBUG #ifdef NX_TRANS_DEBUG
fprintf(stderr, "WaitForSomething: Milliseconds to next wakeup are %ld.\n", fprintf(stderr, "WaitForSomething: Milliseconds to next wakeup are %ld.\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