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/sockets.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libvncserver/sockets.c') diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c index a9c5a2c..2bb655e 100644 --- a/libvncserver/sockets.c +++ b/libvncserver/sockets.c @@ -391,7 +391,15 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec) if (FD_ISSET(cl->sock, &(rfbScreen->allFds))) { if (FD_ISSET(cl->sock, &fds)) + { +#ifdef LIBVNCSERVER_WITH_WEBSOCKETS + do { + rfbProcessClientMessage(cl); + } while (webSocketsHasDataInBuffer(cl)); +#else rfbProcessClientMessage(cl); +#endif + } else rfbSendFileTransferChunk(cl); } -- cgit v1.2.3