Revert "Removed delay and check for nanosleep (replaced by ready message in libguac)"

This reverts commit a9ea3ac383de3f92e5b0d29449f1daa618b60624.
This commit is contained in:
Michael Jumper 2011-03-06 17:01:00 -08:00
parent b46c5187be
commit 4044b61f56
2 changed files with 23 additions and 0 deletions

View File

@ -52,6 +52,7 @@ AC_CHECK_HEADERS([stdlib.h string.h syslog.h guacamole/client.h guacamole/guacio
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([nanosleep])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@ -217,6 +217,23 @@ void guac_vnc_cut_text(rfbClient* client, const char* text, int textlen) {
}
void vnc_guac_client_sleep(int millis) {
#ifdef HAVE_NANOSLEEP
struct timespec sleep_period;
sleep_period.tv_sec = 0;
sleep_period.tv_nsec = millis * 1000000L;
nanosleep(&sleep_period, NULL);
#elif defined(__MINGW32__)
Sleep(millis)
#else
#warning No sleep/nanosleep function available. VNC client may not perform as expected. Consider editing the vnc_client.c to add support for your platform.
#endif
}
int vnc_guac_client_handle_messages(guac_client* client) {
int wait_result;
@ -236,6 +253,11 @@ int vnc_guac_client_handle_messages(guac_client* client) {
return 1;
}
/* Wait before returning ... don't want to handle
* too many server messages. */
vnc_guac_client_sleep(50);
}
return 0;