Example #1
0
 protected void EnqueueSubscription(Action <InfoQueryResponse, CancellationToken> callback, IEnumerable <XElement> content)
 {
     QueuedSubscriptions.Enqueue(() => new InfoQuery {
         Type = "set", From = null, To = BareJID, Content = content, Callback = callback
     });
     SubscriptionsQueued.Set();
 }
Example #2
0
        protected void ProcessQueuedQueries(XmlStream xml, CancellationToken canceltoken)
        {
            InfoQuery iq;

            if (IsReadyForSubscriptions)
            {
                Func <InfoQuery> iqfactory;
                while (!canceltoken.IsCancellationRequested && QueuedSubscriptions.TryDequeue(out iqfactory))
                {
                    ProcessInfoQuery(xml, iqfactory());
                }
            }

            while (!canceltoken.IsCancellationRequested && QueuedQueries.TryDequeue(out iq))
            {
                ProcessInfoQuery(xml, iq);
            }

            canceltoken.ThrowIfCancellationRequested();
        }