summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2019-01-06 19:30:16 +0100
committerChristian Beier <dontmind@freeshell.org>2019-01-06 19:30:16 +0100
commit14c24e2bcc05578e37dfd64b6efe73774a288c90 (patch)
treea7a6d1d83d3000e09944d00fe79d27e31f3733c1
parentffa449ad01d803acdace6d178ef198d9abdcc16f (diff)
downloadlibtdevnc-14c24e2bcc05578e37dfd64b6efe73774a288c90.tar.gz
libtdevnc-14c24e2bcc05578e37dfd64b6efe73774a288c90.zip
Fix comment style and be a bit more verbose
... explaining cedae6e6f97b14f5df3ea7c5f7efd59f2bc9ad82.
-rw-r--r--libvncserver/main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libvncserver/main.c b/libvncserver/main.c
index 17bef7e..d3cd9b1 100644
--- a/libvncserver/main.c
+++ b/libvncserver/main.c
@@ -566,7 +566,7 @@ clientInput(void *data)
if (FD_ISSET(cl->pipe_notify_client_thread[0], &rfds))
{
- // Reset the pipe
+ /* Reset the pipe */
char buf;
while (read(cl->pipe_notify_client_thread[0], &buf, sizeof(buf)) == sizeof(buf));
}
@@ -1112,8 +1112,13 @@ void rfbShutdownServer(rfbScreenInfoPtr screen,rfbBool disconnectClients) {
}
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
- // Notify the thread and join it
+ /*
+ Notify the thread. This simply writes a NULL byte to the notify pipe in order to get past the select()
+ in clientInput(), the loop in there will then break because the rfbCloseClient() above has set
+ currentCl->sock to -1.
+ */
write(currentCl->pipe_notify_client_thread[1], "\x00", 1);
+ /* And wait for it to finish. */
pthread_join(currentCl->client_thread, NULL);
#else
rfbClientConnectionGone(currentCl);