Commit 1f5f1679 authored by Christian Beier's avatar Christian Beier

Merge pull request #57 from maxnet/master

Fix handling of multiple VNC commands per websockets frame
parents b568db93 6836ccb2
......@@ -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. */
......
......@@ -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);
}
......
......@@ -905,3 +905,16 @@ webSocketCheckDisconnect(rfbClientPtr cl)
return FALSE;
}
/* returns TRUE if there is data waiting to be read in our internal buffer
* or if is there any pending data in the buffer of the SSL implementation
*/
rfbBool
webSocketsHasDataInBuffer(rfbClientPtr cl)
{
ws_ctx_t *wsctx = (ws_ctx_t *)cl->wsctx;
if (wsctx && wsctx->readbuflen)
return TRUE;
return (cl->sslctx && rfbssl_pending(cl) > 0);
}
......@@ -765,6 +765,7 @@ extern rfbBool webSocketsCheck(rfbClientPtr cl);
extern rfbBool webSocketCheckDisconnect(rfbClientPtr cl);
extern int webSocketsEncode(rfbClientPtr cl, const char *src, int len, char **dst);
extern int webSocketsDecode(rfbClientPtr cl, char *dst, int len);
extern rfbBool webSocketsHasDataInBuffer(rfbClientPtr cl);
#endif
/* rfbserver.c */
......
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