public async override IAsyncEnumerable <TPackageInfo> RunAsync() { while (true) { var package = await _packagePipe.ReadAsync(); if (package == null) { await HandleClosing(); yield break; } yield return(package); } }
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); } }
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); } }