示例#1
0
        public override bool equivalent(EndpointI endpoint)
        {
            if (!(endpoint is IPEndpointI))
            {
                return(false);
            }
            IPEndpointI ipEndpointI = (IPEndpointI)endpoint;

            return(ipEndpointI.type() == type() && ipEndpointI.host_.Equals(host_) && ipEndpointI.port_ == port_ &&
                   Network.addressEquals(ipEndpointI.sourceAddr_, sourceAddr_));
        }
示例#2
0
        public void resolve(string host, int port, Ice.EndpointSelectionType selType, IPEndpointI endpoint,
            EndpointI_connectors 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.
            //
            NetworkProxy networkProxy = _instance.networkProxy();
            if(networkProxy == null)
            {
                try
                {
                    List<EndPoint> addrs = Network.getAddresses(host, port, _protocol, selType, _preferIPv6, false);
                    if(addrs.Count > 0)
                    {
                        callback.connectors(endpoint.connectors(addrs, null));
                        return;
                    }
                }
                catch(Ice.LocalException ex)
                {
                    callback.exception(ex);
                    return;
                }
            }

            lock(this)
            {
                Debug.Assert(!_destroyed);

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

                Ice.Instrumentation.CommunicatorObserver obsv = _instance.initializationData().observer;
                if(obsv != null)
                {
                    entry.observer = obsv.getEndpointLookupObserver(endpoint);
                    if(entry.observer != null)
                    {
                        entry.observer.attach();
                    }
                }

                _queue.AddLast(entry);
                System.Threading.Monitor.Pulse(this);
            }
        }
示例#3
0
        public override int CompareTo(EndpointI obj)
        {
            if (!(obj is IPEndpointI))
            {
                return(type() < obj.type() ? -1 : 1);
            }

            IPEndpointI p = (IPEndpointI)obj;

            if (this == p)
            {
                return(0);
            }

            int v = string.Compare(host_, p.host_, StringComparison.Ordinal);

            if (v != 0)
            {
                return(v);
            }

            if (port_ < p.port_)
            {
                return(-1);
            }
            else if (p.port_ < port_)
            {
                return(1);
            }

            int rc = string.Compare(Network.endpointAddressToString(sourceAddr_),
                                    Network.endpointAddressToString(p.sourceAddr_), StringComparison.Ordinal);

            if (rc != 0)
            {
                return(rc);
            }

            return(string.Compare(connectionId_, p.connectionId_, StringComparison.Ordinal));
        }
示例#4
0
 public void resolve(string host, int port, Ice.EndpointSelectionType type, IPEndpointI endpt,
                     EndpointI_connectors callback)
 {
     instance_.endpointHostResolver().resolve(host, port, type, endpt, callback);
 }
示例#5
0
 public InfoI(IPEndpointI e)
 {
     _endpoint = e;
 }
示例#6
0
 public InfoI(IPEndpointI e)
 {
     _endpoint = e;
 }
示例#7
0
        public void resolve(string host, int port, Ice.EndpointSelectionType selType, IPEndpointI endpoint,
                            EndpointI_connectors 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.
            //
            NetworkProxy networkProxy = _instance.networkProxy();

            if (networkProxy == null)
            {
                try
                {
                    List <EndPoint> addrs = Network.getAddresses(host, port, _protocol, selType, _preferIPv6, false);
                    if (addrs.Count > 0)
                    {
                        callback.connectors(endpoint.connectors(addrs, null));
                        return;
                    }
                }
                catch (Ice.LocalException ex)
                {
                    callback.exception(ex);
                    return;
                }
            }

            lock (this)
            {
                Debug.Assert(!_destroyed);

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

                Ice.Instrumentation.CommunicatorObserver obsv = _instance.initializationData().observer;
                if (obsv != null)
                {
                    entry.observer = obsv.getEndpointLookupObserver(endpoint);
                    if (entry.observer != null)
                    {
                        entry.observer.attach();
                    }
                }

                _queue.AddLast(entry);
                Monitor.Pulse(this);
            }
        }
示例#8
0
文件: WSEndpoint.cs 项目: externl/ice
 internal WSEndpoint(ProtocolInstance instance, EndpointI del, string res)
 {
     _instance = instance;
     _delegate = (IPEndpointI)del;
     _resource = res;
 }
示例#9
0
文件: WSEndpoint.cs 项目: externl/ice
        internal WSEndpoint(ProtocolInstance instance, EndpointI del, Ice.InputStream s)
        {
            _instance = instance;
            _delegate = (IPEndpointI)del;

            _resource = s.readString();
        }
示例#10
0
文件: WSEndpoint.cs 项目: externl/ice
        internal WSEndpoint(ProtocolInstance instance, EndpointI del, List<string> args)
        {
            _instance = instance;
            _delegate = (IPEndpointI)del;

            initWithOptions(args);

            if(_resource == null)
            {
                _resource = "/";
            }
        }
示例#11
0
 public void resolve(string host, int port, Ice.EndpointSelectionType type, IPEndpointI endpt,
                     EndpointI_connectors callback)
 {
     instance_.endpointHostResolver().resolve(host, port, type, endpt, callback);
 }