示例#1
0
        private async Task ReceiveAsync(string account, long from, CancellationToken cancellationToken = default)
        {
            IsReceiving = true;
            while (!cancellationToken.IsCancellationRequested)
            {
                try
                {
                    await semaphore.WaitAsync(cancellationToken).ContinueWith(tsk => { });

                    var tmpFrom = (long)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
                    var result  = await MakeRequestAsync(new StatementRequest(account, from)).ConfigureAwait(false);

                    from = tmpFrom;
                    if (result != null)
                    {
                        foreach (var statementItem in result)
                        {
                            OnStatement?.Invoke(this, new StatementEventArgs(account, statementItem));
                        }
                    }
                    await Task.Delay(Convert.ToInt32(Timeout.TotalMilliseconds));
                }
                catch (Exception)
                {
                }
                finally
                {
                    semaphore.Release();
                }
            }
        }
 public virtual T Visit(OnStatement node)
 {
     Visit((Statement)node);
     return(traverse(node.body));
 }
示例#3
0
 public override bool Visit(OnStatement node)
 {
     Visit((Statement)node);
     TraversePrint(node.body);
     return(true);
 }