websockets: Better disconnect detection.

If the only thing we are waiting on is a WebSockets terminator, then
remove it from the stream early on in rfbProcessClientNormalMessage.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
pull/1/head
Joel Martin 13 years ago committed by Johannes Schindelin
parent 6fac22a74b
commit 0860c4951f

@ -1844,6 +1844,11 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
/* With Base64 encoding we need at least 4 bytes */ /* With Base64 encoding we need at least 4 bytes */
n = recv(cl->sock, encBuf, 4, MSG_PEEK); n = recv(cl->sock, encBuf, 4, MSG_PEEK);
if ((n > 0) && (n < 4)) { if ((n > 0) && (n < 4)) {
if (encBuf[0] == '\xff') {
/* Make sure we don't miss a client disconnect on an end frame
* marker */
n = read(cl->sock, encBuf, 1);
}
return; return;
} }
} }

Loading…
Cancel
Save