Exemplo n.º 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_));
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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));
        }
Exemplo n.º 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);
 }
Exemplo n.º 5
0
 public InfoI(IPEndpointI e)
 {
     _endpoint = e;
 }
Exemplo n.º 6
0
 public InfoI(IPEndpointI e)
 {
     _endpoint = e;
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 8
0
 internal WSEndpoint(ProtocolInstance instance, EndpointI del, string res)
 {
     _instance = instance;
     _delegate = (IPEndpointI)del;
     _resource = res;
 }
Exemplo n.º 9
0
        internal WSEndpoint(ProtocolInstance instance, EndpointI del, Ice.InputStream s)
        {
            _instance = instance;
            _delegate = (IPEndpointI)del;

            _resource = s.readString();
        }
Exemplo n.º 10
0
        internal WSEndpoint(ProtocolInstance instance, EndpointI del, List<string> args)
        {
            _instance = instance;
            _delegate = (IPEndpointI)del;

            initWithOptions(args);

            if(_resource == null)
            {
                _resource = "/";
            }
        }
Exemplo n.º 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);
 }