Ejemplo n.º 1
0
    ConnectorsAsync(EndpointSelectionType selType)
    {
        _configuration.CheckConnectorsException();
        IEnumerable <IceInternal.IConnector> connectors = await _endpoint.ConnectorsAsync(selType).ConfigureAwait(false);

        return(connectors.Select(item => new Connector(item)));
    }
Ejemplo n.º 2
0
        public override async ValueTask <IEnumerable <IConnector> > ConnectorsAsync(EndpointSelectionType endptSelection)
        {
            string host = "";

            for (Endpoint?p = _delegate; p != null; p = p.Underlying)
            {
                if (p is IPEndpoint ipEndpoint)
                {
                    host = $"{ipEndpoint.Host}:{ipEndpoint.Port.ToString(CultureInfo.InvariantCulture)}";
                    break;
                }
            }
            IEnumerable <IConnector> connectors = await _delegate.ConnectorsAsync(endptSelection).ConfigureAwait(false);

            return(connectors.Select(item => new WSConnector(_instance, item, host, Resource)));
        }
Ejemplo n.º 3
0
            public async ValueTask GetConnectorsAsync(IReadOnlyList <Endpoint> endpoints)
            {
                try
                {
                    //
                    // Notify the factory that there's an async connect pending. This is necessary
                    // to prevent the outgoing connection factory to be destroyed before all the
                    // pending asynchronous connects are finished.
                    //
                    _factory.IncPendingConnectCount();
                }
                catch (System.Exception ex)
                {
                    _callback.SetException(ex);
                    return;
                }

                System.Exception?exception = null;
                for (int i = 0; i < endpoints.Count; ++i)
                {
                    Endpoint endpoint = endpoints[i];
                    try
                    {
                        IEnumerable <IConnector> ctrs = await endpoint.ConnectorsAsync(_selType).ConfigureAwait(false);

                        _connectors.AddRange(ctrs.Select(item => new ConnectorInfo(item, endpoint)));
                    }
                    catch (Exception ex)
                    {
                        exception = ex;
                        _factory.HandleException(ex, _hasMore || (i + 1) < endpoints.Count);
                    }
                }

                if (_connectors.Count == 0)
                {
                    _callback.SetException(exception !);
                    _factory.DecPendingConnectCount(); // Must be called last.
                }
                else
                {
                    GetConnection();
                }
            }