diff options
author | Joel Martin <github@martintribe.org> | 2011-08-16 14:02:32 +0200 |
---|---|---|
committer | Johannes Schindelin <johannes.schindelin@gmx.de> | 2011-08-17 12:41:24 +0200 |
commit | 0860c4951fd1b6d90158c35ead4a4c33635802bb (patch) | |
tree | faae1fc5873ef8beeeddff214007d1f5ea3266a5 | |
parent | 6fac22a74b5020387a6961e4cc197b5fa4743f96 (diff) | |
download | libvncserver-0860c4951fd1b6d90158c35ead4a4c33635802bb.zip libvncserver-0860c4951fd1b6d90158c35ead4a4c33635802bb.tar.gz |
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>
-rw-r--r-- | libvncserver/rfbserver.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c index 1df4fee..491a438 100644 --- a/libvncserver/rfbserver.c +++ b/libvncserver/rfbserver.c @@ -1844,6 +1844,11 @@ rfbProcessClientNormalMessage(rfbClientPtr cl) /* With Base64 encoding we need at least 4 bytes */ n = recv(cl->sock, encBuf, 4, MSG_PEEK); 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; } } |