KafkaNet.KafkaTcpSocket.GetStreamAsync C# (CSharp) Method

GetStreamAsync() private method

private GetStreamAsync ( ) : Task
return Task
        private async Task<NetworkStream> GetStreamAsync()
        {
            //using a semaphore here to allow async waiting rather than blocking locks
            using (await _clientLock.LockAsync(_disposeToken.Token).ConfigureAwait(false))
            {
                if ((_client == null || _client.Connected == false) && !_disposeToken.IsCancellationRequested)
                {
                    _client = await ReEstablishConnectionAsync().ConfigureAwait(false);
                }

                return _client == null ? null : _client.GetStream();
            }
        }