Exemplo n.º 1
0
 /// <summary>
 /// Cancel the KCD query specified and set its reference to null,
 /// if needed.
 /// </summary>
 protected void ClearKcdQuery(ref KcdQuery query)
 {
     if (query != null)
     {
         query.Terminate();
         query = null;
     }
 }
Exemplo n.º 2
0
Arquivo: Vnc.cs Projeto: tmbx/kwm-ng
        /// <summary>
        /// Clean up the state when the session has completed to avoid resource
        /// leaks. This object CANNOT be reused for another session since some
        /// recently cancelled threads may still reference the object and try
        /// to modify its state.
        /// </summary>
        private void Terminate()
        {
            Status = VncSessionStatus.Completed;
            AppVnc.SessionPresentFlag = false;
            App.LocalSession          = null;

            if (Overlay != null)
            {
                Overlay.Terminate();
                Overlay = null;
            }

            if (TicketQuery != null)
            {
                TicketQuery.Terminate();
                TicketQuery = null;
            }

            if (Tunnel != null)
            {
                Tunnel.Terminate();
                Tunnel = null;
            }

            if (TunnelThread != null)
            {
                TunnelThread.RequestCancellation();
                TunnelThread = null;
            }

            if (MainProcess != null)
            {
                MainProcess.Terminate();
                MainProcess = null;
            }

            if (DummyProcess != null)
            {
                DummyProcess.Terminate();
                DummyProcess = null;
            }

            if (Timer != null)
            {
                Timer.WakeMeUp(-1);
                Timer = null;
            }

            if (InactivityMonitor != null)
            {
                InactivityMonitor.Enabled = false;
                InactivityMonitor.Dispose();
                InactivityMonitor = null;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Process an ANP reply received from the KCD.
        /// </summary>
        private static void ProcessKcdAnpReply(WmKcd kcd, AnpMsg msg)
        {
            // We have no knowledge of the query. Ignore the reply.
            if (!kcd.QueryMap.ContainsKey(msg.ID))
            {
                return;
            }

            // Retrieve and remove the query from the query map.
            KcdQuery query = kcd.QueryMap[msg.ID];

            // Set the reply in the query.
            query.Res = msg;

            // We don't have non-workspace-related replies yet.
            Debug.Assert(query.Kws != null);

            // Dispatch the message to the workspace.
            query.Kws.Sm.HandleKcdReply(query);
            query.Terminate();
        }
Exemplo n.º 4
0
 /// <summary>
 /// Cancel the KCD query specified and set its reference to null, 
 /// if needed.
 /// </summary>
 protected void ClearKcdQuery(ref KcdQuery query)
 {
     if (query != null)
     {
         query.Terminate();
         query = null;
     }
 }