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.
diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx
index 03b1bca..e001449 100644
--- a/win/winvnc/VNCServerWin32.cxx
+++ b/win/winvnc/VNCServerWin32.cxx
@@ -76,6 +76,7 @@
// Register the desktop's event to be handled
sockMgr.addEvent(desktop.getUpdateEvent(), &desktop);
+ sockMgr.addEvent(desktop.getTerminateEvent(), this);
// Register the queued command event to be handled
sockMgr.addEvent(commandEvent, this);
@@ -335,7 +336,8 @@
command = NoCommand;
commandSig->signal();
}
- } else if (event_ == sessionEvent.h) {
+ } else if ((event_ == sessionEvent.h) ||
+ (event_ == desktop.getTerminateEvent())) {
stop();
}
}