Esempio n. 1
0
        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;
                    }
                }
            }
        }
Esempio n. 2
0
        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);
        }