コード例 #1
0
        // Token: 0x0600056A RID: 1386 RVA: 0x000200D0 File Offset: 0x0001E2D0
        private void BlockDevice(AutoblockThresholdType autoblockThresholdType)
        {
            AirSyncDiagnostics.TraceInfo <AutoblockThresholdType>(ExTraceGlobals.RequestsTracer, this, "BlockDevice {0}", autoblockThresholdType);
            EnhancedTimeSpan deviceBlockDuration = ADNotificationManager.GetAutoBlockThreshold(autoblockThresholdType).DeviceBlockDuration;
            ExDateTime       utcNow = ExDateTime.UtcNow;

            lock (this.instanceLock)
            {
                if (this.blockTime > utcNow || this.nextUnblockTime < utcNow)
                {
                    this.blockTime       = utcNow;
                    this.nextUnblockTime = utcNow + deviceBlockDuration;
                    this.autoBlockReason = DeviceAccessStateReason.UserAgentsChanges + (int)autoblockThresholdType;
                    this.timeToUpdateAD  = utcNow;
                    this.SaveDeviceBehavior(true);
                    if (deviceBlockDuration != EnhancedTimeSpan.Zero)
                    {
                        AirSyncCounters.AutoBlockedDevices.Increment();
                    }
                    if (this.ProtocolLogger != null)
                    {
                        this.ProtocolLogger.SetValue(ProtocolLoggerData.AutoBlockEvent, autoblockThresholdType.ToString());
                    }
                }
            }
        }
コード例 #2
0
 public static DeviceAutoBlockThreshold GetAutoBlockThreshold(AutoblockThresholdType type)
 {
     AirSyncDiagnostics.TraceDebug <AutoblockThresholdType>(ExTraceGlobals.RequestsTracer, null, "GetAutoblockThreshold data.AutoblockThresholdType {0}", type);
     if (!Enum.IsDefined(typeof(AutoblockThresholdType), type))
     {
         AirSyncDiagnostics.TraceError(ExTraceGlobals.RequestsTracer, null, "InvalidAutoblockReason");
         throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.SyncStateCorrupt, null, false)
               {
                   ErrorStringForProtocolLogger = "InvalidAutoblockReason"
               };
     }
     if (ADNotificationManager.autoBlockThresholds == null || ADNotificationManager.autoBlockThresholds.DeviceAutoBlockThresholds == null || ADNotificationManager.autoBlockThresholds.WhenCreated.Add(GlobalSettings.ADCacheExpirationTimeout) < ExDateTime.UtcNow)
     {
         lock (ADNotificationManager.startLock)
         {
             if (ADNotificationManager.autoBlockThresholds == null || ADNotificationManager.autoBlockThresholds.DeviceAutoBlockThresholds == null || ADNotificationManager.autoBlockThresholds.WhenCreated.Add(GlobalSettings.ADCacheExpirationTimeout) < ExDateTime.UtcNow)
             {
                 AirSyncDiagnostics.TraceDebug <AutoblockThresholdType>(ExTraceGlobals.RequestsTracer, null, "refresh AutoblockThreshold data from AD.AutoblockThresholdType {0}", type);
                 ADNotificationManager.LoadAutoBlockThresholds();
             }
         }
     }
     return(ADNotificationManager.autoBlockThresholds.DeviceAutoBlockThresholds[(int)type]);
 }
コード例 #3
0
 public DeviceAutoBlockThreshold(AutoblockThresholdType type)
 {
     this.BehaviorType   = type;
     this.LastChangeTime = ExDateTime.UtcNow;
 }
コード例 #4
0
        public static DeviceAutoBlockThreshold GetAutoBlockThreshold(DeviceAccessStateReason reason)
        {
            AutoblockThresholdType type = (AutoblockThresholdType)(reason - 6);

            return(ADNotificationManager.GetAutoBlockThreshold(type));
        }