コード例 #1
0
        public bool Remove(IServerSession session)
        {
            if (session == null)
            {
                return(false);
            }

            bool exist = false;

            lock (_sessions)
            {
                var unicastAddress = session.UnicastAddress;
                exist = _sessions.RemoveValue(unicastAddress, session);
                if (exist)
                {
                    LeaveAll(session);
                }
            }

            if (exist)
            {
                session.Close();
                ServerEvents.AsyncRaiseClientDisconnectedEvent(_server, session);
            }

            return(exist);
        }