From 6836ccb208f8c16824b8c1e330acb077c70c98c6 Mon Sep 17 00:00:00 2001 From: Floris Bos Date: Sat, 17 Jan 2015 22:49:48 +0100 Subject: Fix handling of multiple VNC commands per websockets frame - When processing input, check if there is any extra data pending in the internal websocket frame and SSL buffers. - Prevents input events lagging behind because they get stuck in one of the buffers. Data pending in our own buffers cannot be detected with select() so was not processed until more input arrives from the network. - Closes # 55 Signed-off-by: Floris Bos --- libvncserver/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libvncserver/main.c') diff --git a/libvncserver/main.c b/libvncserver/main.c index 9839c85..a8458e4 100644 --- a/libvncserver/main.c +++ b/libvncserver/main.c @@ -550,7 +550,15 @@ clientInput(void *data) rfbSendFileTransferChunk(cl); if (FD_ISSET(cl->sock, &rfds) || FD_ISSET(cl->sock, &efds)) + { +#ifdef LIBVNCSERVER_WITH_WEBSOCKETS + do { + rfbProcessClientMessage(cl); + } while (webSocketsHasDataInBuffer(cl)); +#else rfbProcessClientMessage(cl); +#endif + } } /* Get rid of the output thread. */ -- cgit v1.2.3 From 63bc75f24b8a82910f5864d5c3348e284be66ade Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 18 Nov 2016 08:23:11 +0100 Subject: Fix some typos (found by codespell) Signed-off-by: Stefan Weil --- libvncserver/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libvncserver/main.c') diff --git a/libvncserver/main.c b/libvncserver/main.c index a8458e4..47dac11 100644 --- a/libvncserver/main.c +++ b/libvncserver/main.c @@ -582,7 +582,7 @@ listenerRun(void *data) socklen_t len; fd_set listen_fds; /* temp file descriptor list for select() */ - /* TODO: this thread wont die by restarting the server */ + /* TODO: this thread won't die by restarting the server */ /* TODO: HTTP is not handled */ while (1) { client_fd = -1; -- cgit v1.2.3 From 78b101f09d01141488261b96dcc01c9aec5f1649 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Wed, 28 Dec 2016 19:41:52 +0100 Subject: LibVNCServer: fix starting of an onHold-client in threaded mode. Discovered by madscientist159 on 11 Jan 2015: "noted in testing with the threaded server build, whereby if newClientHook() returned RFB_CLIENT_ON_HOLD there was no way to release the hold when the server became ready" --- libvncserver/main.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'libvncserver/main.c') diff --git a/libvncserver/main.c b/libvncserver/main.c index 47dac11..dbda77d 100644 --- a/libvncserver/main.c +++ b/libvncserver/main.c @@ -612,21 +612,18 @@ listenerRun(void *data) return(NULL); } -void -rfbStartOnHoldClient(rfbClientPtr cl) -{ - pthread_create(&cl->client_thread, NULL, clientInput, (void *)cl); -} - -#else +#endif void rfbStartOnHoldClient(rfbClientPtr cl) { - cl->onHold = FALSE; + cl->onHold = FALSE; +#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD + if(cl->screen->backgroundLoop) + pthread_create(&cl->client_thread, NULL, clientInput, (void *)cl); +#endif } -#endif void rfbRefuseOnHoldClient(rfbClientPtr cl) -- cgit v1.2.3