示例#1
0
        /// <summary>
        /// Process a KCD connection notice.
        /// </summary>
        private static void ProcessKcdConnectionNotice(KcdConnectionNotice notice)
        {
            Debug.Assert(Wm.KcdTree.ContainsKey(notice.KcdID));
            WmKcd kcd = Wm.KcdTree[notice.KcdID];

            Debug.Assert(kcd.ConnStatus == KcdConnStatus.Connecting ||
                         kcd.ConnStatus == KcdConnStatus.Disconnecting);

            // We do not want the KCD to be connected anymore. Ignore the
            // message.
            if (kcd.ConnStatus == KcdConnStatus.Disconnecting)
            {
                return;
            }

            // The KCD is now connected.
            kcd.ConnStatus   = KcdConnStatus.Connected;
            kcd.MinorVersion = notice.MinorVersion;
            kcd.ClearError(true);

            // Notify every workspace that the KCD is connected. Stop if the KCD
            // state changes while notifications are being sent.
            foreach (Workspace kws in kcd.KwsTree.Values)
            {
                if (kcd.ConnStatus != KcdConnStatus.Connected)
                {
                    break;
                }
                kws.Sm.HandleKcdConnStatusChange(KcdConnStatus.Connected, null);
            }
        }
示例#2
0
 /// <summary>
 /// Clear the errors associated to the KCD specified, reset the number
 /// of failed connection attempts to 0 and request a run of the state
 /// machine, if required. This can be used to force a KCD to reconnect
 /// sooner than usual.
 /// </summary>
 public static void ResetKcdFailureState(WmKcd kcd)
 {
     if (kcd.FailedConnectCount != 0 || kcd.ErrorDate != DateTime.MinValue)
     {
         kcd.ClearError(true);
         RequestRun("cleared KCD error");
     }
 }
示例#3
0
        /// <summary>
        /// Connect a KCD if it is disconnected.
        /// </summary>
        private static void ConnectKcd(WmKcd kcd)
        {
            if (kcd.ConnStatus != KcdConnStatus.Disconnected)
            {
                return;
            }

            // Clear the current error, but not the failed connection count.
            kcd.ClearError(false);

            // Send a connection request.
            kcd.ConnStatus = KcdConnStatus.Connecting;
            Wm.KcdBroker.RequestKcdConnect(kcd.KcdID);

            // Notify the listeners.
            foreach (Workspace kws in kcd.KwsTree.Values)
            {
                kws.Sm.HandleKcdConnStatusChange(KcdConnStatus.Connecting, null);
            }
        }
示例#4
0
        /// <summary>
        /// Connect a KCD if it is disconnected.
        /// </summary>
        private static void ConnectKcd(WmKcd kcd)
        {
            if (kcd.ConnStatus != KcdConnStatus.Disconnected) return;

            // Clear the current error, but not the failed connection count.
            kcd.ClearError(false);

            // Send a connection request.
            kcd.ConnStatus = KcdConnStatus.Connecting;
            Wm.KcdBroker.RequestKcdConnect(kcd.KcdID);

            // Notify the listeners.
            foreach (Workspace kws in kcd.KwsTree.Values)
                kws.Sm.HandleKcdConnStatusChange(KcdConnStatus.Connecting, null);
        }
示例#5
0
 /// <summary>
 /// Clear the errors associated to the KCD specified, reset the number
 /// of failed connection attempts to 0 and request a run of the state 
 /// machine, if required. This can be used to force a KCD to reconnect
 /// sooner than usual.
 /// </summary>
 public static void ResetKcdFailureState(WmKcd kcd)
 {
     if (kcd.FailedConnectCount != 0 || kcd.ErrorDate != DateTime.MinValue)
     {
         kcd.ClearError(true);
         RequestRun("cleared KCD error");
     }
 }