internal async Task InitializeAsync() { //try to connect via GCCP foreach (var uri in _clusterOptions.Servers) { try { var endPoint = uri.GetIpEndPoint(11210, false); var bootstrapNode = await GetClusterNode(endPoint, uri).ConfigureAwait(false); //note this returns bucketConfig, but clusterConfig will be returned once server supports GCCP _clusterConfig = await bootstrapNode.GetClusterMap().ConfigureAwait(false); if (_clusterConfig == null)//TODO fix bug NCBC-1966 - hiding XError when no error map (and others) { //No GCCP but we connected - save connections and info for connecting later _clusterOptions.GlobalNodes.Add(bootstrapNode); } else { foreach (var nodesExt in _clusterConfig.GetNodes()) { //This is the bootstrap node so we update it if (uri.Host == nodesExt.Hostname) { bootstrapNode.NodesAdapter = nodesExt; bootstrapNode.BuildServiceUris(); _clusterOptions.GlobalNodes.Add(bootstrapNode); } else { endPoint = IpEndPointExtensions.GetEndPoint(nodesExt.Hostname, 11210); var clusterNode = await GetClusterNode(endPoint, uri).ConfigureAwait(false); clusterNode.NodesAdapter = nodesExt; clusterNode.BuildServiceUris(); _clusterOptions.GlobalNodes.Add(clusterNode); } } // get cluster capabilities UpdateClusterCapabilities(_clusterConfig.GetClusterCapabilities()); _hasBootStrapped = true; } } catch (AuthenticationException e) { //auth failed so bubble up exception and clean up resources Log.LogError(e, @"Could not authenticate user {_clusterOptions.UserName}"); while (_clusterOptions.GlobalNodes.TryTake(out IClusterNode clusterNode)) { clusterNode.Dispose(); } throw; } } }