Пример #1
0
        private async Task ProcessNetworkstreamTasksReadTask(NetworkStream netStream)
        {
            Task lastReadTask = Task.FromResult(true);

            while (_disposeToken.IsCancellationRequested == false && netStream != null)
            {
                await lastReadTask;
                bool  hasAvailableData = await _readTaskQueue.OnHasDataAvailablebool(_disposeToken.Token);

                if (!hasAvailableData)
                {
                    return;
                }
                var read = _readTaskQueue.Pop();
                lastReadTask = ProcessReadTaskAsync(netStream, read);
            }
        }