summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2010-11-18 14:36:52 +0100
committerChristian Beier <dontmind@freeshell.org>2010-11-18 15:00:40 +0100
commita5f8d3a3109b545219ad5b34859f1b7d3b8b6d56 (patch)
tree3d95811e5718cdd139b8bda28c3ecc318d4a035a
parent079394ca5b14d8067b95a9cf95a834828b4425a6 (diff)
downloadlibtdevnc-a5f8d3a3109b545219ad5b34859f1b7d3b8b6d56.tar.gz
libtdevnc-a5f8d3a3109b545219ad5b34859f1b7d3b8b6d56.zip
libvncserver: fix endless loop when server closed client in threaded mode.
Signed-off-by: Christian Beier <dontmind@freeshell.org>
-rw-r--r--libvncserver/main.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libvncserver/main.c b/libvncserver/main.c
index 5332e2d..b128581 100644
--- a/libvncserver/main.c
+++ b/libvncserver/main.c
@@ -517,6 +517,11 @@ clientInput(void *data)
struct timeval tv;
int n;
+ if (cl->sock == -1) {
+ /* Client has disconnected. */
+ break;
+ }
+
FD_ZERO(&rfds);
FD_SET(cl->sock, &rfds);
FD_ZERO(&efds);
@@ -546,11 +551,6 @@ clientInput(void *data)
if (FD_ISSET(cl->sock, &rfds) || FD_ISSET(cl->sock, &efds))
rfbProcessClientMessage(cl);
-
- if (cl->sock == -1) {
- /* Client has disconnected. */
- break;
- }
}
/* Get rid of the output thread. */