Exemplo n.º 1
0
 // Token: 0x06001068 RID: 4200 RVA: 0x0003EF00 File Offset: 0x0003D100
 internal void AddRemoteNotificationPayload(RemoteNotificationPayload remoteNotificationPayload)
 {
     lock (this)
     {
         if (this.reloadAll)
         {
             NotificationStatisticsManager.Instance.NotificationReceived(remoteNotificationPayload);
             NotificationStatisticsManager.Instance.NotificationDropped(remoteNotificationPayload, NotificationState.CreatedOrReceived);
         }
         else if (this.queue.Count >= 40)
         {
             NotificationStatisticsManager.Instance.NotificationReceived(remoteNotificationPayload);
             NotificationStatisticsManager.Instance.NotificationDropped(remoteNotificationPayload, NotificationState.CreatedOrReceived);
             NotificationStatisticsManager.Instance.NotificationDropped(this.queue, NotificationState.CreatedOrReceived);
             this.queue.Clear();
             ReloadAllNotificationPayload reloadAllNotificationPayload = new ReloadAllNotificationPayload();
             reloadAllNotificationPayload.Source = new TypeLocation(base.GetType());
             this.queue.Enqueue(reloadAllNotificationPayload);
             NotificationStatisticsManager.Instance.NotificationCreated(reloadAllNotificationPayload);
             this.reloadAll = true;
         }
         else
         {
             this.queue.Enqueue(remoteNotificationPayload);
             NotificationStatisticsManager.Instance.NotificationReceived(remoteNotificationPayload);
         }
     }
 }
 // Token: 0x06000E6C RID: 3692 RVA: 0x00036644 File Offset: 0x00034844
 public void NotificationDropped(NotificationPayloadBase payload, NotificationState state)
 {
     if (NotificationStatisticsManager.IncomingNotificationStatisticsEnabled && NotificationStatisticsManager.IsStatisticable(payload))
     {
         this.incomingNotifications.Update(payload.Source, payload, delegate(NotificationStatisticsValue v, NotificationPayloadBase p)
         {
             NotificationStatisticsManager.UpdateNotificationDropped(v, p, state);
         });
         this.TriggerLogCheck();
     }
     if (NotificationStatisticsManager.OutgoingNotificationStatisticsEnabled)
     {
         RemoteNotificationPayload remoteNotificationPayload = payload as RemoteNotificationPayload;
         if (remoteNotificationPayload != null && remoteNotificationPayload.ChannelIds != null)
         {
             foreach (string channelId in remoteNotificationPayload.ChannelIds)
             {
                 this.outgoingNotifications.Update(new ChannelLocation(channelId), payload, delegate(NotificationStatisticsValue v, NotificationPayloadBase p)
                 {
                     NotificationStatisticsManager.UpdateNotificationDropped(v, p, state);
                 });
             }
         }
     }
 }
        // Token: 0x06000FFC RID: 4092 RVA: 0x0003D678 File Offset: 0x0003B878
        internal string[] DeliverRemoteNotification(IEnumerable <string> channelIds, RemoteNotificationPayload remoteNotificationPayload)
        {
            List <string> list = new List <string>();
            Dictionary <PendingRequestManager, bool> dictionary = new Dictionary <PendingRequestManager, bool>();

            foreach (string text in channelIds)
            {
                PendingRequestManager pendingGetManager = this.listenerChannelsManager.GetPendingGetManager(text);
                if (pendingGetManager == null)
                {
                    list.Add(text);
                }
                else if (!dictionary.ContainsKey(pendingGetManager))
                {
                    pendingGetManager.GetRemoteNotifier.AddRemoteNotificationPayload(remoteNotificationPayload);
                    pendingGetManager.GetRemoteNotifier.PickupData();
                    dictionary.Add(pendingGetManager, true);
                }
            }
            return(list.ToArray());
        }
Exemplo n.º 4
0
        private void WriteNotification(bool asyncOperation)
        {
            if (!this.lockTracker.IsLockOwner())
            {
                throw new OwaInvalidOperationException("A thread that is not the owner of the lock can't call WriteNotification!");
            }
            bool flag = false;

            while (!flag)
            {
                if (this.disposePendingRequest)
                {
                    this.CloseCurrentPendingRequest(asyncOperation, true);
                    return;
                }
                try
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.Append("[");
                    lock (this.syncRoot)
                    {
                        if (this.payloadList != null)
                        {
                            if (!this.reloadNeeded)
                            {
                                foreach (NotificationPayloadBase notificationPayloadBase in this.payloadList)
                                {
                                    RemoteNotificationPayload remoteNotificationPayload = notificationPayloadBase as RemoteNotificationPayload;
                                    if (remoteNotificationPayload != null)
                                    {
                                        stringBuilder.Append(remoteNotificationPayload.RemotePayload).Append(",");
                                        this.notificationMark += (long)remoteNotificationPayload.NotificationsCount;
                                    }
                                    else
                                    {
                                        stringBuilder.Append(JsonConverter.ToJSON(notificationPayloadBase)).Append(",");
                                        this.notificationMark += 1L;
                                    }
                                }
                                if (stringBuilder.Length > 1)
                                {
                                    stringBuilder.Remove(stringBuilder.Length - 1, 1);
                                    stringBuilder.Append("]");
                                    this.Write(stringBuilder.ToString());
                                }
                                NotificationStatisticsManager.Instance.NotificationDispatched(this.channelId, this.payloadList);
                                this.payloadList.Clear();
                            }
                            else
                            {
                                ReloadAllNotificationPayload payload = new ReloadAllNotificationPayload
                                {
                                    Source = new TypeLocation(base.GetType())
                                };
                                NotificationStatisticsManager.Instance.NotificationCreated(payload);
                                NotificationStatisticsManager.Instance.NotificationDispatched(this.channelId, payload);
                            }
                            this.reloadNeeded = false;
                            this.WriteNotificationMark(this.notificationMark);
                        }
                    }
                }
                finally
                {
                    flag = this.lockTracker.TryReleaseLock();
                }
                if (flag)
                {
                    return;
                }
            }
        }