Exemplo n.º 1
0
        void ProcessSponsorResponse(object state, bool timedOut)
        {
            if (!timedOut)
            {
                try
                {
                    IAsyncResult ar      = (IAsyncResult)state;
                    TimeSpan     newSpan = _renewalDelegate.EndInvoke(ar);
                    if (newSpan != TimeSpan.Zero)
                    {
                        Renew(newSpan);
                        _currentState     = LeaseState.Active;
                        _renewingSponsors = null;
                        return;
                    }
                }
                catch { }
            }

            // Sponsor failed, timed out, or returned TimeSpan.Zero

            Unregister((ISponsor)_renewingSponsors.Dequeue());                  // Drop the sponsor
            CheckNextSponsor();
        }