summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2014-03-29 15:03:12 -0500
committerJohannes Schindelin <johannes.schindelin@gmx.de>2014-04-05 18:37:58 -0500
commit71d0f9b06fd3f574d79dcf9593fb8b6299c6143d (patch)
tree54fc951f8329c0d398e78dcca35c6f66fef4272f
parentc0e012e4d26f2bc38ee5d34c3ee75e94cc799767 (diff)
downloadlibtdevnc-71d0f9b06fd3f574d79dcf9593fb8b6299c6143d.tar.gz
libtdevnc-71d0f9b06fd3f574d79dcf9593fb8b6299c6143d.zip
Repeater example: show how to shut down cleanly
Since we connected to the client through the repeater, chances are that we want this server shut down once the client disconnected. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
-rw-r--r--examples/repeater.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/repeater.c b/examples/repeater.c
index ae65e25..cf0350f 100644
--- a/examples/repeater.c
+++ b/examples/repeater.c
@@ -2,6 +2,11 @@
#include <rfb/rfb.h>
+static void clientGone(rfbClientPtr cl)
+{
+ rfbShutdownServer(cl->screen, TRUE);
+}
+
int main(int argc,char** argv)
{
char *repeaterHost;
@@ -53,6 +58,7 @@ int main(int argc,char** argv)
return 1;
}
cl->reverseConnection = 0;
+ cl->clientGoneHook = clientGone;
/* Run the server */
rfbInitServer(server);