private async Task ProcessAsync() { using (_settingsWriter) { while (true) { var connection = await StreamTransmissionConnection .CreateAsync(UniqueId.Generate(), AcceptStreamAsync) .ConfigureAwait(false); try { await _buffer.Out .WriteAsync(connection, CancellationToken) .ConfigureAwait(false); } catch { await connection.DisconnectAsync().IgnoreExceptions().ConfigureAwait(false); throw; } } } }
public async ValueTask <ITransmissionConnection> ConnectAsync(string brokerWorkingDir, CancellationToken cancellationToken) { var connection = await StreamTransmissionConnection.CreateAsync( UniqueId.Generate(), () => ConnectStreamAsync(brokerWorkingDir, cancellationToken)); Log.Trace("Created connection {0}", connection); return(connection); }