예제 #1
0
파일: WmAnpTunnel.cs 프로젝트: tmbx/kwm-ng
        protected override void Run()
        {
            // Connect the tunnel.
            InternalAnpTunnel = new AnpTunnel(Host, Port);
            Tunnel tunnel = InternalAnpTunnel.GetTunnel();

            InternalAnpTunnel.BeginConnect(ReconnectHost, ReconnectPort);

            while (true)
            {
                SelectSockets set = new SelectSockets();
                set.Timeout = 100;
                tunnel.CheckTls();
                set.AddRead(tunnel.Sock);
                Block(set);
                if (set.ReadSockets.Contains(tunnel.Sock))
                {
                    InternalAnpTunnel.CreateTransport();
                    break;
                }
            }

            // Handle the tunnel.
            OnTunnelConnected();
        }
예제 #2
0
파일: Vnc.cs 프로젝트: 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;
            }
        }
예제 #3
0
 public KcdThreadHost(KcdIdentifier kcdID)
 {
     KcdID  = kcdID;
     Tunnel = new AnpTunnel(KcdID.Host, (int)KcdID.Port);
 }
예제 #4
0
파일: Vnc.cs 프로젝트: 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;
            }
        }
예제 #5
0
파일: WmKcdThread.cs 프로젝트: tmbx/kwm-ng
 public KcdThreadHost(KcdIdentifier kcdID)
 {
     KcdID = kcdID;
     Tunnel = new AnpTunnel(KcdID.Host, (int)KcdID.Port);
 }
예제 #6
0
파일: WmAnpTunnel.cs 프로젝트: tmbx/kwm-ng
        protected override void Run()
        {
            // Connect the tunnel.
            InternalAnpTunnel = new AnpTunnel(Host, Port);
            Tunnel tunnel = InternalAnpTunnel.GetTunnel();
            InternalAnpTunnel.BeginConnect(ReconnectHost, ReconnectPort);

            while (true)
            {
                SelectSockets set = new SelectSockets();
                set.Timeout = 100;
                tunnel.CheckTls();
                set.AddRead(tunnel.Sock);
                Block(set);
                if (set.ReadSockets.Contains(tunnel.Sock))
                {
                    InternalAnpTunnel.CreateTransport();
                    break;
                }
            }

            // Handle the tunnel.
            OnTunnelConnected();
        }