예제 #1
0
        //
        // AddIdleServicePoint -
        //
        //  Adds a ServicePoint to our idle list, done, when a servicePoint
        //    detects that its connection count goes to 0.  And its ready to idle.
        //
        internal static void AddIdleServicePoint(ServicePoint servicePoint)
        {
            GlobalLog.Enter("ServicePointManager::AddIdleServicePoint() servicePoint#" + ValidationHelper.HashString(servicePoint) + " ExpiresAt:" + (servicePoint.ExpiresAt.ToFileTime()).ToString());
            lock (s_StrongReferenceServicePointList) {
                // DateTime.Now wasn't accurate enough to guarantee uniqueness
                while (s_StrongReferenceServicePointList.IndexOfKey(servicePoint.ExpiresAt) != -1)
                {
                    servicePoint.IncrementExpiresAt();
                }

                GlobalLog.Assert(
                    !s_StrongReferenceServicePointList.ContainsValue(servicePoint),
                    "s_StrongReferenceServicePointList.ContainsValue(servicePoint)",
                    "s_StrongReferenceServicePointList should not have a value added twice");

                s_StrongReferenceServicePointList.Add(servicePoint.ExpiresAt, servicePoint);
            }
            GlobalLog.Leave("ServicePointManager::AddIdleServicePoint");
        }
예제 #2
0
        //
        // AddIdleServicePoint -
        //
        //  Adds a ServicePoint to our idle list, done, when a servicePoint
        //    detects that its connection count goes to 0.  And its ready to idle.
        //
        internal static void AddIdleServicePoint(ServicePoint servicePoint) {
            GlobalLog.Enter("ServicePointManager::AddIdleServicePoint() servicePoint#" + ValidationHelper.HashString(servicePoint) + " ExpiresAt:" + (servicePoint.ExpiresAt.ToFileTime()).ToString());
            lock (s_StrongReferenceServicePointList) {

                // DateTime.Now wasn't accurate enough to guarantee uniqueness
                while (s_StrongReferenceServicePointList.IndexOfKey(servicePoint.ExpiresAt) != -1) {
                    servicePoint.IncrementExpiresAt();
                }

                GlobalLog.Assert(
                    ! s_StrongReferenceServicePointList.ContainsValue(servicePoint),
                    "s_StrongReferenceServicePointList.ContainsValue(servicePoint)",
                    "s_StrongReferenceServicePointList should not have a value added twice" );

                s_StrongReferenceServicePointList.Add(servicePoint.ExpiresAt, servicePoint);
            }
            GlobalLog.Leave("ServicePointManager::AddIdleServicePoint");
        }