예제 #1
0
        private void LeaseTimeAnalyzer(object state)
        {
            DateTime utcNow = DateTime.UtcNow;

            lock (this.leaseToTimeTable)
            {
                IDictionaryEnumerator local_3 = this.leaseToTimeTable.GetEnumerator();
                while (local_3.MoveNext())
                {
                    DateTime local_4 = (DateTime)local_3.Value;
                    Lease    local_5 = (Lease)local_3.Key;
                    if (local_4.CompareTo(utcNow) < 0)
                    {
                        this.tempObjects.Add((object)local_5);
                    }
                }
                for (int local_6 = 0; local_6 < this.tempObjects.Count; ++local_6)
                {
                    this.leaseToTimeTable.Remove((object)(Lease)this.tempObjects[local_6]);
                }
            }
            for (int index = 0; index < this.tempObjects.Count; ++index)
            {
                Lease lease = (Lease)this.tempObjects[index];
                if (lease != null)
                {
                    lease.LeaseExpired(utcNow);
                }
            }
            this.tempObjects.Clear();
            lock (this.sponsorTable)
            {
                IDictionaryEnumerator local_10 = this.sponsorTable.GetEnumerator();
                while (local_10.MoveNext())
                {
                    object temp_72 = local_10.Key;
                    LeaseManager.SponsorInfo local_11 = (LeaseManager.SponsorInfo)local_10.Value;
                    if (local_11.sponsorWaitTime.CompareTo(utcNow) < 0)
                    {
                        this.tempObjects.Add((object)local_11);
                    }
                }
                for (int local_12 = 0; local_12 < this.tempObjects.Count; ++local_12)
                {
                    this.sponsorTable.Remove(((LeaseManager.SponsorInfo) this.tempObjects[local_12]).sponsorId);
                }
            }
            for (int index = 0; index < this.tempObjects.Count; ++index)
            {
                LeaseManager.SponsorInfo sponsorInfo = (LeaseManager.SponsorInfo) this.tempObjects[index];
                if (sponsorInfo != null && sponsorInfo.lease != null)
                {
                    sponsorInfo.lease.SponsorTimeout(sponsorInfo.sponsorId);
                    this.tempObjects[index] = (object)null;
                }
            }
            this.tempObjects.Clear();
            this.leaseTimer.Change((int)this.pollTime.TotalMilliseconds, -1);
        }
        private void LeaseTimeAnalyzer(object state)
        {
            DateTime  utcNow = DateTime.UtcNow;
            Hashtable obj    = this.leaseToTimeTable;

            lock (obj)
            {
                IDictionaryEnumerator enumerator = this.leaseToTimeTable.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    DateTime dateTime = (DateTime)enumerator.Value;
                    Lease    value    = (Lease)enumerator.Key;
                    if (dateTime.CompareTo(utcNow) < 0)
                    {
                        this.tempObjects.Add(value);
                    }
                }
                for (int i = 0; i < this.tempObjects.Count; i++)
                {
                    Lease key = (Lease)this.tempObjects[i];
                    this.leaseToTimeTable.Remove(key);
                }
            }
            for (int j = 0; j < this.tempObjects.Count; j++)
            {
                Lease lease = (Lease)this.tempObjects[j];
                if (lease != null)
                {
                    lease.LeaseExpired(utcNow);
                }
            }
            this.tempObjects.Clear();
            Hashtable obj2 = this.sponsorTable;

            lock (obj2)
            {
                IDictionaryEnumerator enumerator2 = this.sponsorTable.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    object key2 = enumerator2.Key;
                    LeaseManager.SponsorInfo sponsorInfo = (LeaseManager.SponsorInfo)enumerator2.Value;
                    if (sponsorInfo.sponsorWaitTime.CompareTo(utcNow) < 0)
                    {
                        this.tempObjects.Add(sponsorInfo);
                    }
                }
                for (int k = 0; k < this.tempObjects.Count; k++)
                {
                    LeaseManager.SponsorInfo sponsorInfo2 = (LeaseManager.SponsorInfo) this.tempObjects[k];
                    this.sponsorTable.Remove(sponsorInfo2.sponsorId);
                }
            }
            for (int l = 0; l < this.tempObjects.Count; l++)
            {
                LeaseManager.SponsorInfo sponsorInfo3 = (LeaseManager.SponsorInfo) this.tempObjects[l];
                if (sponsorInfo3 != null && sponsorInfo3.lease != null)
                {
                    sponsorInfo3.lease.SponsorTimeout(sponsorInfo3.sponsorId);
                    this.tempObjects[l] = null;
                }
            }
            this.tempObjects.Clear();
            this.leaseTimer.Change((int)this.pollTime.TotalMilliseconds, -1);
        }