Added support for terminating inactive/active/disconnected sessions. This is a port of the SF patch 1025108.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@203 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfb/VNCSConnectionST.cxx b/rfb/VNCSConnectionST.cxx
index a20ec01..ce48b3e 100644
--- a/rfb/VNCSConnectionST.cxx
+++ b/rfb/VNCSConnectionST.cxx
@@ -98,6 +98,10 @@
   else
     vlog.debug("second close: %s (%s)", peerEndpoint.buf, reason);
 
+  if (authenticated()) {
+      server->lastDisconnectTime = time(0);
+  }
+
   // Just shutdown the socket.  This will cause processMessages to
   // eventually fail, causing us and our socket to be deleted.
   sock->shutdown();
@@ -389,6 +393,7 @@
 void VNCSConnectionST::pointerEvent(int x, int y, int buttonMask)
 {
   pointerEventTime = lastEventTime = time(0);
+  server->lastUserInputTime = lastEventTime;
   if (!(accessRights & AccessPtrEvents)) return;
   if (!rfb::Server::acceptPointerEvents) return;
   if (!server->pointerClient || server->pointerClient == this) {
@@ -421,6 +426,7 @@
 // multiple down events (for autorepeat), but only allow a single up event.
 void VNCSConnectionST::keyEvent(rdr::U32 key, bool down) {
   lastEventTime = time(0);
+  server->lastUserInputTime = lastEventTime;
   if (!(accessRights & AccessKeyEvents)) return;
   if (!rfb::Server::acceptKeyEvents) return;