Exemple #1
0
        /// <summary>
        /// Disconnect a client and remove it form the client list
        /// </summary>
        /// <param name="name">Client name</param>
        public void RemoveConnection(string name)
        {
            if (!AllConnections.ContainsKey(name))
            {
                return;
            }

            TConnection Conn = AllConnections[name];

            AllConnectionsList.Remove(Conn);

            Conn.IncomingData = null;
            Conn.OutgoingData = null;

            AllConnections.Remove(name);
        }
Exemple #2
0
        private void CleanupConnections(object sender)
        {
            for (int i = 0; i < AllConnectionsList.Count; i++)
            {
                var C = AllConnectionsList[i];
                if (C.ConnStats.HasTimedOut)
                {
                    if (C.ConnectionSocket.Connected)
                    {
                        C.ConnectionSocket.Disconnect(false);
                    }

                    AllConnectionsList.Remove(C);
                    AllConnections.Remove(C.Address);
                }
            }
        }