예제 #1
0
        public static async Task<Stream> GetAsync(string streamName, CancellationToken cancellationToken)
        {
            var stream = new ClientDirectStream(streamName);

            try
            {
                // try to connect direct stream
                await stream.ConnectAsync(cancellationToken).ConfigureAwait(false);
                return stream;
            }
            catch
            {
                // make sure we dispose stream in case ConnectAsync failed
                stream.Dispose();
                throw;
            }
        }
예제 #2
0
        public static async Task <Stream> GetAsync(string streamName, CancellationToken cancellationToken)
        {
            var stream = new ClientDirectStream(streamName);

            try
            {
                // try to connect direct stream
                await stream.ConnectAsync(cancellationToken).ConfigureAwait(false);

                return(stream);
            }
            catch
            {
                // make sure we dispose stream in case ConnectAsync failed
                stream.Dispose();
                throw;
            }
        }