/// <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; } }
/// <summary> /// Open the tunnel used by the VNC process. /// </summary> private void OpenTunnel() { Status = VncSessionStatus.Tunnel; TunnelThread = new VncTunnelThread(this); TunnelThread.Start(); }