diff options
author | Pierre Ossman <ossman@cendio.se> | 2018-09-29 11:24:19 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2018-11-09 17:25:23 +0100 |
commit | 10688efcf759f24e83814f9e12a1275296b07a4c (patch) | |
tree | 51d46d026e8cc9c04aae739e52582c6566c45112 /unix/x0vncserver | |
parent | f43137c61bd19fd3a7a51833c9eb9bb9f890a904 (diff) | |
download | tigervnc-10688efcf759f24e83814f9e12a1275296b07a4c.tar.gz tigervnc-10688efcf759f24e83814f9e12a1275296b07a4c.zip |
Properly terminate server on timeouts
Do a proper cleanup when one of the termination timeouts trigger
rather than just exiting on the spot. This makes sure we don't leave
stray stuff around, e.g. unix socket files.
Diffstat (limited to 'unix/x0vncserver')
-rw-r--r-- | unix/x0vncserver/XDesktop.cxx | 6 | ||||
-rw-r--r-- | unix/x0vncserver/XDesktop.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx index 9a047c8e..3e67fad0 100644 --- a/unix/x0vncserver/XDesktop.cxx +++ b/unix/x0vncserver/XDesktop.cxx @@ -19,6 +19,8 @@ */ #include <assert.h> +#include <signal.h> +#include <unistd.h> #include <rfb/LogWriter.h> @@ -273,6 +275,10 @@ void XDesktop::stop() { pb = 0; } +void XDesktop::terminate() { + kill(getpid(), SIGTERM); +} + bool XDesktop::isRunning() { return running; } diff --git a/unix/x0vncserver/XDesktop.h b/unix/x0vncserver/XDesktop.h index 7d060613..3e85aac3 100644 --- a/unix/x0vncserver/XDesktop.h +++ b/unix/x0vncserver/XDesktop.h @@ -49,6 +49,7 @@ public: // -=- SDesktop interface virtual void start(rfb::VNCServer* vs); virtual void stop(); + virtual void terminate(); bool isRunning(); virtual void queryConnection(network::Socket* sock, const char* userName); |