From 10688efcf759f24e83814f9e12a1275296b07a4c Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sat, 29 Sep 2018 11:24:19 +0200 Subject: 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. --- unix/xserver/hw/vnc/XserverDesktop.cc | 6 ++++++ unix/xserver/hw/vnc/XserverDesktop.h | 1 + 2 files changed, 7 insertions(+) (limited to 'unix/xserver') diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc index e61472b3..d4891c3a 100644 --- a/unix/xserver/hw/vnc/XserverDesktop.cc +++ b/unix/xserver/hw/vnc/XserverDesktop.cc @@ -22,6 +22,7 @@ // #include +#include #include #include #include @@ -423,6 +424,11 @@ void XserverDesktop::approveConnection(uint32_t opaqueId, bool accept, // SDesktop callbacks +void XserverDesktop::terminate() +{ + kill(getpid(), SIGTERM); +} + void XserverDesktop::pointerEvent(const Point& pos, int buttonMask) { vncPointerMove(pos.x + vncGetScreenX(screenIndex), diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h index ff36b3b5..1253935f 100644 --- a/unix/xserver/hw/vnc/XserverDesktop.h +++ b/unix/xserver/hw/vnc/XserverDesktop.h @@ -87,6 +87,7 @@ public: // rfb::SDesktop callbacks virtual void start(rfb::VNCServer* vs); virtual void stop(); + virtual void terminate(); virtual void queryConnection(network::Socket* sock, const char* userName); virtual void pointerEvent(const rfb::Point& pos, int buttonMask); -- cgit v1.2.3