Пример #1
0
        public async override IAsyncEnumerable <TPackageInfo> RunAsync()
        {
            while (true)
            {
                var package = await _packagePipe.ReadAsync();

                if (package == null)
                {
                    await HandleClosing();

                    yield break;
                }

                yield return(package);
            }
        }
Пример #2
0
        public async override IAsyncEnumerable <TPackageInfo> RunAsync()
        {
            var readsTask = ProcessReads();
            var sendsTask = ProcessSends();

            while (true)
            {
                var package = await _packagePipe.ReadAsync();

                if (package == null)
                {
                    await HandleClosing(readsTask, sendsTask);

                    yield break;
                }

                yield return(package);
            }
        }
Пример #3
0
        public async override IAsyncEnumerable <TPackageInfo> RunAsync()
        {
            if (_readsTask == null || _sendsTask == null)
            {
                throw new Exception("The channel has not been started yet.");
            }

            while (true)
            {
                var package = await _packagePipe.ReadAsync().ConfigureAwait(false);

                if (package == null)
                {
                    await HandleClosing();

                    yield break;
                }

                yield return(package);
            }
        }