/// <summary> /// Request a KCD to be connected. /// </summary> public void RequestKcdConnect(KcdIdentifier kcdID) { lock (m_mutex) { // The following sequence of events can happen: // - KCD thread posts a disconnection event. // - WM posts an ANP message. // - WM receives a disconnection event. // - WM posts a connection request. // - KCD thread receives the connection request and the ANP message concurrently, // possibly posting the ANP message incorrectly. // To prevent this situation, we ensure that we have no lingering // ANP message left for that KCD. List <KcdAnpMsg> newList = new List <KcdAnpMsg>(); foreach (KcdAnpMsg m in m_toThreadAnpMsgArray) { if (m.KcdID != kcdID) { newList.Add(m); } } m_toThreadAnpMsgArray = newList; m_toThreadControlMsgArray.Add(new KcdConnectionRequest(kcdID, true)); NotifyKcdThread(); } }
/// <summary> /// Request a KCD to be disconnected. /// </summary> public void RequestKcdDisconnect(KcdIdentifier kcdID) { lock (m_mutex) { m_toThreadControlMsgArray.Add(new KcdConnectionRequest(kcdID, false)); NotifyKcdThread(); } }
/// <summary> /// Create the WmKcd object specified if it does not exist, and return /// a reference to the WmKcd object specified, if any. /// </summary> public static WmKcd GetOrCreateKcd(KcdIdentifier kcdID) { if (kcdID.Host == "") { return(null); } if (!KcdTree.ContainsKey(kcdID)) { KcdTree[kcdID] = new WmKcd(kcdID); } return(KcdTree[kcdID]); }
public int CompareTo(Object obj) { KcdIdentifier kcd = (KcdIdentifier)obj; int r = kcd.Host.CompareTo(Host); if (r != 0) { return(r); } return(kcd.Port.CompareTo(Port)); }
/// <summary> /// Return the workspace having the Kcd ID and external ID specified, /// if any. /// </summary> public static Workspace GetKwsByExternalID(KcdIdentifier kcdID, UInt64 externalID) { if (externalID == 0) { return(null); } foreach (Workspace kws in KwsTree.Values) { if (kws.Kcd.KcdID.CompareTo(kcdID) == 0 && kws.Cd.Credentials.ExternalID == externalID) { return(kws); } } return(null); }
public KcdAnpMsg(AnpMsg msg, KcdIdentifier kcdID) { Msg = msg; KcdID = kcdID; }
public KcdConnectionNotice(KcdIdentifier kcdID, UInt32 minorVersion) { KcdID = kcdID; MinorVersion = minorVersion; }
/// <summary> /// Create the WmKcd object specified if it does not exist, and return /// a reference to the WmKcd object specified, if any. /// </summary> public static WmKcd GetOrCreateKcd(KcdIdentifier kcdID) { if (kcdID.Host == "") return null; if (!KcdTree.ContainsKey(kcdID)) KcdTree[kcdID] = new WmKcd(kcdID); return KcdTree[kcdID]; }
public WmKcd(KcdIdentifier kcdID) { KcdID = kcdID; }
/// <summary> /// Request a KCD to be connected. /// </summary> public void RequestKcdConnect(KcdIdentifier kcdID) { lock (m_mutex) { // The following sequence of events can happen: // - KCD thread posts a disconnection event. // - WM posts an ANP message. // - WM receives a disconnection event. // - WM posts a connection request. // - KCD thread receives the connection request and the ANP message concurrently, // possibly posting the ANP message incorrectly. // To prevent this situation, we ensure that we have no lingering // ANP message left for that KCD. List<KcdAnpMsg> newList = new List<KcdAnpMsg>(); foreach (KcdAnpMsg m in m_toThreadAnpMsgArray) { if (m.KcdID != kcdID) newList.Add(m); } m_toThreadAnpMsgArray = newList; m_toThreadControlMsgArray.Add(new KcdConnectionRequest(kcdID, true)); NotifyKcdThread(); } }
public KcdDisconnectionNotice(KcdIdentifier kcdID, Exception ex) { KcdID = kcdID; Ex = ex; }
public KcdConnectionRequest(KcdIdentifier kcdID, bool connectFlag) { KcdID = kcdID; ConnectFlag = connectFlag; }
/// <summary> /// Return the workspace having the Kcd ID and external ID specified, /// if any. /// </summary> public static Workspace GetKwsByExternalID(KcdIdentifier kcdID, UInt64 externalID) { if (externalID == 0) return null; foreach (Workspace kws in KwsTree.Values) if (kws.Kcd.KcdID.CompareTo(kcdID) == 0 && kws.Cd.Credentials.ExternalID == externalID) return kws; return null; }
public KcdThreadHost(KcdIdentifier kcdID) { KcdID = kcdID; Tunnel = new AnpTunnel(KcdID.Host, (int)KcdID.Port); }