mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Sleeping between calls to VNC message handler.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
CFLAGS=-O2 -ansi -pedantic -Wall -Werror
|
CFLAGS=-O2 -pedantic -Wall -Werror
|
||||||
LDFLAGS=-lpng -lvncclient
|
LDFLAGS=-lpng -lvncclient
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include <rfb/rfbclient.h>
|
#include <rfb/rfbclient.h>
|
||||||
|
|
||||||
@@ -175,6 +176,7 @@ void vnc_guac_client_handle_messages(guac_client* client) {
|
|||||||
int wait_result;
|
int wait_result;
|
||||||
rfbClient* rfb_client = ((vnc_guac_client_data*) client->data)->rfb_client;
|
rfbClient* rfb_client = ((vnc_guac_client_data*) client->data)->rfb_client;
|
||||||
|
|
||||||
|
|
||||||
wait_result = WaitForMessage(rfb_client, 2000);
|
wait_result = WaitForMessage(rfb_client, 2000);
|
||||||
if (wait_result < 0) {
|
if (wait_result < 0) {
|
||||||
fprintf(stderr, "WAIT FAIL\n");
|
fprintf(stderr, "WAIT FAIL\n");
|
||||||
@@ -183,11 +185,21 @@ void vnc_guac_client_handle_messages(guac_client* client) {
|
|||||||
|
|
||||||
if (wait_result > 0) {
|
if (wait_result > 0) {
|
||||||
|
|
||||||
|
struct timespec sleep_period;
|
||||||
|
|
||||||
if (!HandleRFBServerMessage(rfb_client)) {
|
if (!HandleRFBServerMessage(rfb_client)) {
|
||||||
fprintf(stderr, "HANDLE FAIL\n");
|
fprintf(stderr, "HANDLE FAIL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Wait before returning ... don't want to handle
|
||||||
|
* too many server messages. */
|
||||||
|
|
||||||
|
sleep_period.tv_sec = 0;
|
||||||
|
sleep_period.tv_nsec = 50000000L /* 50 ms */;
|
||||||
|
|
||||||
|
nanosleep(&sleep_period, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user