예제 #1
0
        public async Task ConnectAsync(TimeSpan timeout)
        {
            // using async lock
            using (await _lock.LockAsync())
            {
                if (_connection != null && _connection.CheckState())
                {
                    return;
                }

                if (_connection != null && !_connection.CheckState())
                {
                    await _connection.ShutdowmAsync();
                }

                _connection = new GrpcConnection(GetServer(_connection?.Server));
                await _connection.ConnectAsync(timeout);
            }
        }
예제 #2
0
        public async Task ConnectAsync()
        {
            // using async lock
            using (await _lock.LockAsync())
            {
                if (_connection != null && _connection.CheckState())
                {
                    return;
                }

                _connection = new GrpcConnection(GetServer(_connection?.Server));
                await _connection.ConnectAsync();
            }
        }