コード例 #1
0
ファイル: WmStateMachine.cs プロジェクト: tmbx/kwm-ng
        /// <summary>
        /// Process a KCD disconnection notice.
        /// </summary>
        private static void ProcessKcdDisconnectionNotice(KcdDisconnectionNotice notice)
        {
            Debug.Assert(Wm.KcdTree.ContainsKey(notice.KcdID));
            WmKcd kcd = Wm.KcdTree[notice.KcdID];

            Debug.Assert(kcd.ConnStatus != KcdConnStatus.Disconnected);

            // The KCD died unexpectedly.
            if (kcd.ConnStatus != KcdConnStatus.Disconnecting)
            {
                // Handle the offense.
                if (notice.Ex != null)
                {
                    // Increase the failed connection attempt count if were
                    // connecting.
                    AssignErrorToKcd(kcd, (kcd.ConnStatus == KcdConnStatus.Connecting));
                }
            }

            // The KCD is now disconnected.
            kcd.ConnStatus = KcdConnStatus.Disconnected;

            // Clear the command-reply mappings associated to the KCD.
            kcd.QueryMap.Clear();

            // Notify every workspace that the KCD is disconnected.
            foreach (Workspace kws in kcd.KwsTree.Values)
            {
                kws.Sm.HandleKcdConnStatusChange(KcdConnStatus.Disconnected, notice.Ex);
            }

            // Remove the KCD if we no longer need it.
            Wm.RemoveKcdIfNoRef(kcd);

            // Re-run the state machine, in case we want to reconnect to the KCD
            // or stop.
            RequestRun("KCD disconnected");
        }
コード例 #2
0
ファイル: WmStateMachine.cs プロジェクト: tmbx/kwm-ng
        /// <summary>
        /// Process a KCD disconnection notice.
        /// </summary>
        private static void ProcessKcdDisconnectionNotice(KcdDisconnectionNotice notice)
        {
            Debug.Assert(Wm.KcdTree.ContainsKey(notice.KcdID));
            WmKcd kcd = Wm.KcdTree[notice.KcdID];
            Debug.Assert(kcd.ConnStatus != KcdConnStatus.Disconnected);

            // The KCD died unexpectedly.
            if (kcd.ConnStatus != KcdConnStatus.Disconnecting)
            {
                // Handle the offense.
                if (notice.Ex != null)
                {
                    // Increase the failed connection attempt count if were
                    // connecting.
                    AssignErrorToKcd(kcd, (kcd.ConnStatus == KcdConnStatus.Connecting));
                }
            }

            // The KCD is now disconnected.
            kcd.ConnStatus = KcdConnStatus.Disconnected;

            // Clear the command-reply mappings associated to the KCD.
            kcd.QueryMap.Clear();

            // Notify every workspace that the KCD is disconnected.
            foreach (Workspace kws in kcd.KwsTree.Values)
                kws.Sm.HandleKcdConnStatusChange(KcdConnStatus.Disconnected, notice.Ex);

            // Remove the KCD if we no longer need it.
            Wm.RemoveKcdIfNoRef(kcd);

            // Re-run the state machine, in case we want to reconnect to the KCD
            // or stop.
            RequestRun("KCD disconnected");
        }