Ejemplo n.º 1
0
        /// <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();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Request a KCD to be disconnected.
 /// </summary>
 public void RequestKcdDisconnect(KcdIdentifier kcdID)
 {
     lock (m_mutex)
     {
         m_toThreadControlMsgArray.Add(new KcdConnectionRequest(kcdID, false));
         NotifyKcdThread();
     }
 }
Ejemplo n.º 3
0
 /// <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]);
 }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
 /// <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);
 }
Ejemplo n.º 6
0
 public KcdAnpMsg(AnpMsg msg, KcdIdentifier kcdID)
 {
     Msg   = msg;
     KcdID = kcdID;
 }
Ejemplo n.º 7
0
 public KcdConnectionNotice(KcdIdentifier kcdID, UInt32 minorVersion)
 {
     KcdID = kcdID;
     MinorVersion = minorVersion;
 }
Ejemplo n.º 8
0
 /// <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];
 }
Ejemplo n.º 9
0
Archivo: WmKcd.cs Proyecto: tmbx/kwm-ng
 public WmKcd(KcdIdentifier kcdID)
 {
     KcdID = kcdID;
 }
Ejemplo n.º 10
0
 public WmKcd(KcdIdentifier kcdID)
 {
     KcdID = kcdID;
 }
Ejemplo n.º 11
0
 public KcdAnpMsg(AnpMsg msg, KcdIdentifier kcdID)
 {
     Msg = msg;
     KcdID = kcdID;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Request a KCD to be disconnected.
 /// </summary>
 public void RequestKcdDisconnect(KcdIdentifier kcdID)
 {
     lock (m_mutex)
     {
         m_toThreadControlMsgArray.Add(new KcdConnectionRequest(kcdID, false));
         NotifyKcdThread();
     }
 }
Ejemplo n.º 13
0
        /// <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();
            }
        }
Ejemplo n.º 14
0
 public KcdDisconnectionNotice(KcdIdentifier kcdID, Exception ex)
 {
     KcdID = kcdID;
     Ex = ex;
 }
Ejemplo n.º 15
0
 public KcdConnectionRequest(KcdIdentifier kcdID, bool connectFlag)
 {
     KcdID = kcdID;
     ConnectFlag = connectFlag;
 }
Ejemplo n.º 16
0
 public KcdConnectionRequest(KcdIdentifier kcdID, bool connectFlag)
 {
     KcdID       = kcdID;
     ConnectFlag = connectFlag;
 }
Ejemplo n.º 17
0
 public KcdConnectionNotice(KcdIdentifier kcdID, UInt32 minorVersion)
 {
     KcdID        = kcdID;
     MinorVersion = minorVersion;
 }
Ejemplo n.º 18
0
 /// <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;
 }
Ejemplo n.º 19
0
 public KcdDisconnectionNotice(KcdIdentifier kcdID, Exception ex)
 {
     KcdID = kcdID;
     Ex    = ex;
 }
Ejemplo n.º 20
0
 public KcdThreadHost(KcdIdentifier kcdID)
 {
     KcdID  = kcdID;
     Tunnel = new AnpTunnel(KcdID.Host, (int)KcdID.Port);
 }
Ejemplo n.º 21
0
 public KcdThreadHost(KcdIdentifier kcdID)
 {
     KcdID = kcdID;
     Tunnel = new AnpTunnel(KcdID.Host, (int)KcdID.Port);
 }