Beispiel #1
0
        protected override void OnCompletion()
        {
            // Failure.
            if (Status == WorkerStatus.Cancelled ||
                Status == WorkerStatus.Failed ||
                m_session.Status != VncSessionStatus.Tunnel)
            {
                // Kill the tunnel.
                if (InternalAnpTunnel != null)
                {
                    InternalAnpTunnel.Terminate();
                }

                // Notify the session.
                if (m_session.Status == VncSessionStatus.Tunnel)
                {
                    Debug.Assert(Status != WorkerStatus.Cancelled);
                    m_session.HandleSessionTrouble(FailException);
                }
            }

            // Success.
            else
            {
                // Transfer ownership of the tunnel.
                m_session.Tunnel  = InternalAnpTunnel;
                InternalAnpTunnel = null;

                // Handle the next step.
                m_session.HandleNextSessionStep();
            }
        }