コード例 #1
0
ファイル: WSEndpoint.cs プロジェクト: yuwenyong/ice
 internal EndpointConnectors(TransportInstance instance, string host, string res, IEndpointConnectors cb)
 {
     _instance = instance;
     _host     = host;
     _resource = res;
     _callback = cb;
 }
コード例 #2
0
 internal ResolveEntry(string host, int port, EndpointSelectionType selType, IPEndpoint endpoint, IEndpointConnectors callback)
 {
     Host     = host;
     Port     = port;
     SelType  = selType;
     Endpoint = endpoint;
     Callback = callback;
 }
コード例 #3
0
        public void Resolve(string host, int port, EndpointSelectionType selType, IPEndpoint endpoint,
                            IEndpointConnectors callback)
        {
            //
            // Try to get the addresses without DNS lookup. If this doesn't work, we queue a resolve
            // entry and the thread will take care of getting the endpoint addresses.
            //
            INetworkProxy?networkProxy = NetworkProxy;

            if (networkProxy == null)
            {
                try
                {
                    List <EndPoint> addrs = Network.GetAddresses(host, port, IPVersion, selType, PreferIPv6, false);
                    if (addrs.Count > 0)
                    {
                        callback.Connectors(endpoint.Connectors(addrs, null));
                        return;
                    }
                }
                catch (LocalException ex)
                {
                    callback.Exception(ex);
                    return;
                }
            }

            lock (_endpointHostResolverThread)
            {
                Debug.Assert(!_endpointHostResolverDestroyed);

                var entry = new ResolveEntry(host, port, selType, endpoint, callback);

                Instrumentation.ICommunicatorObserver?obsv = Observer;
                if (obsv != null)
                {
                    entry.Observer = obsv.GetEndpointLookupObserver(endpoint);
                    if (entry.Observer != null)
                    {
                        entry.Observer.Attach();
                    }
                }

                _enpointHostResolverQueue.AddLast(entry);
                Monitor.Pulse(_endpointHostResolverThread);
            }
        }
コード例 #4
0
ファイル: ProtocolInstance.cs プロジェクト: tchernobog/ice
 public void Resolve(string host, int port, Ice.EndpointSelectionType type, IPEndpoint endpt,
                     IEndpointConnectors callback) =>
 Communicator.Resolve(host, port, type, endpt, callback);
コード例 #5
0
 // Returns a connector for this endpoint, or empty list if no connector is available.
 public abstract void ConnectorsAsync(EndpointSelectionType endpointSelection, IEndpointConnectors callback);
コード例 #6
0
 //
 // Return connectors for this endpoint, or empty list if no connector
 // is available.
 //
 public override void ConnectorsAsync(Ice.EndpointSelectionType endSel, IEndpointConnectors callback)
 {
     callback.Connectors(new List <IConnector>());
 }
コード例 #7
0
 //
 // Return a connector for this endpoint, or empty list if no connector
 // is available.
 //
 public abstract void ConnectorsAsync(Ice.EndpointSelectionType selType, IEndpointConnectors callback);
コード例 #8
0
ファイル: IPEndpoint.cs プロジェクト: wolingzong/ice
 public override void ConnectorsAsync(EndpointSelectionType endpointSelection, IEndpointConnectors callback) =>
 Instance.Resolve(Host, Port, endpointSelection, this, callback);
コード例 #9
0
ファイル: WSEndpoint.cs プロジェクト: yuwenyong/ice
        public override void ConnectorsAsync(Ice.EndpointSelectionType endpointSelection, IEndpointConnectors callback)
        {
            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;
                }
            }
            _delegate.ConnectorsAsync(endpointSelection, new EndpointConnectors(_instance, host, Resource, callback));
        }