Example #1
0
            /// <summary>
            /// loop
            /// </summary>
            private void Loop()
            {
                var dtNow = DateTime.UtcNow;

                lock (this)
                {
                    int i = this._queue.Count;
                    while (i-- > 0)
                    {
                        var request = this._queue.Dequeue();
                        if (dtNow.Subtract(request.BeginTime).TotalMilliseconds < this._timeout)
                        {
                            this._queue.Enqueue(request);
                            continue;
                        }
                        ThreadPool.QueueUserWorkItem(_ =>
                        {
                            var ex = new RequestException(RequestException.Errors.PendingSendTimeout, request.CmdName);
                            try { request.SetException(ex); }
                            catch { }
                        });
                    }
                }
            }