Example #1
0
        //
        // Compare endpoints for sorting purposes
        //
        public override int CompareTo(IceInternal.EndpointI obj)
        {
            if (!(obj is EndpointI))
            {
                return(type() < obj.type() ? -1 : 1);
            }

            EndpointI p = (EndpointI)obj;

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

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

            if (!_compress && p._compress)
            {
                return(-1);
            }
            else if (!p._compress && _compress)
            {
                return(1);
            }

            return(base.CompareTo(p));
        }
Example #2
0
        //
        // Return an acceptor for this endpoint, or null if no acceptor
        // is available. In case an acceptor is created, this operation
        // also returns a new "effective" endpoint, which might differ
        // from this endpoint, for example, if a dynamic port number is
        // assigned.
        //
        public override IceInternal.Acceptor acceptor(ref IceInternal.EndpointI endpoint, string adapterName)
        {
            AcceptorI p = new AcceptorI(_instance, adapterName, _host, _port);

            endpoint = new EndpointI(_instance, _host, p.effectivePort(), _timeout, connectionId_, _compress);
            return(p);
        }
Example #3
0
        //
        // Compare endpoints for sorting purposes
        //
        public override int CompareTo(IceInternal.EndpointI obj)
        {
            if (!(obj is EndpointI))
            {
                return(type() < obj.type() ? -1 : 1);
            }

            EndpointI p = (EndpointI)obj;

            if (this == p)
            {
                return(0);
            }
            else
            {
                int r = base.CompareTo(p);
                if (r != 0)
                {
                    return(r);
                }
            }

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

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

            if (!connectionId_.Equals(p.connectionId_))
            {
                return(string.Compare(connectionId_, p.connectionId_, StringComparison.Ordinal));
            }

            if (!_compress && p._compress)
            {
                return(-1);
            }
            else if (!p._compress && _compress)
            {
                return(1);
            }

            return(string.Compare(_host, p._host, StringComparison.Ordinal));
        }
Example #4
0
        public override bool equivalent(IceInternal.EndpointI endpoint)
        {
            if (!(endpoint is EndpointI))
            {
                return(false);
            }
            EndpointI endpointI = (EndpointI)endpoint;

            return(_delegate.equivalent(endpointI._delegate));
        }
Example #5
0
        //
        // Check whether the endpoint is equivalent to another one.
        //
        public override bool equivalent(IceInternal.EndpointI endpoint)
        {
            if (!(endpoint is EndpointI))
            {
                return(false);
            }

            EndpointI sslEndpointI = (EndpointI)endpoint;

            return(sslEndpointI._host.Equals(_host) && sslEndpointI._port == _port);
        }
Example #6
0
 public EndpointI endpoint(IceInternal.EndpointI del)
 {
     if (del == _delegate)
     {
         return(this);
     }
     else
     {
         return(new EndpointI(_instance, del));
     }
 }
Example #7
0
        public override List <IceInternal.EndpointI> expandHost(out IceInternal.EndpointI publish)
        {
            List <IceInternal.EndpointI> l = new List <IceInternal.EndpointI>();

            foreach (IceInternal.EndpointI e in _delegate.expandHost(out publish))
            {
                l.Add(e == _delegate ? this : new EndpointI(_instance, e));
            }
            if (publish != null)
            {
                publish = publish == _delegate ? this : new EndpointI(_instance, publish);
            }
            return(l);
        }
Example #8
0
        //
        // Compare endpoints for sorting purposes
        //
        public override int CompareTo(IceInternal.EndpointI obj)
        {
            if (!(obj is EndpointI))
            {
                return(type() < obj.type() ? -1 : 1);
            }

            EndpointI p = (EndpointI)obj;

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

            return(_delegate.CompareTo(p._delegate));
        }
Example #9
0
 internal EndpointI(Instance instance, IceInternal.EndpointI del)
 {
     _instance = instance;
     _delegate = del;
 }
Example #10
0
 internal EndpointI(Instance instance, IceInternal.EndpointI del)
 {
     _instance = instance;
     _delegate = del;
 }
Example #11
0
 public EndpointI endpoint(IceInternal.EndpointI del)
 {
     return(new EndpointI(_instance, del));
 }
Example #12
0
 internal EndpointI(IceInternal.EndpointI endpoint)
 {
     _endpoint = endpoint;
     _configuration = Configuration.getInstance();
 }
Example #13
0
        internal ConnectionI(Communicator communicator, IceInternal.Instance instance,
                             IceInternal.ACMMonitor monitor, IceInternal.Transceiver transceiver,
                             IceInternal.Connector connector, IceInternal.EndpointI endpoint, ObjectAdapterI adapter)
        {
            _communicator = communicator;
            _instance = instance;
            _monitor = monitor;
            _transceiver = transceiver;
            _desc = transceiver.ToString();
            _type = transceiver.protocol();
            _connector = connector;
            _endpoint = endpoint;
            _adapter = adapter;
            InitializationData initData = instance.initializationData();
            _logger = initData.logger; // Cached for better performance.
            _traceLevels = instance.traceLevels(); // Cached for better performance.
            _timer = instance.timer();
            _writeTimeout = new TimeoutCallback(this);
            _writeTimeoutScheduled = false;
            _readTimeout = new TimeoutCallback(this);
            _readTimeoutScheduled = false;
            _warn = initData.properties.getPropertyAsInt("Ice.Warn.Connections") > 0;
            _warnUdp = initData.properties.getPropertyAsInt("Ice.Warn.Datagrams") > 0;
            _cacheBuffers = instance.cacheMessageBuffers() > 0;
            if(_monitor != null && _monitor.getACM().timeout > 0)
            {
                _acmLastActivity = IceInternal.Time.currentMonotonicTimeMillis();
            }
            else
            {
                _acmLastActivity = -1;
            }
            _nextRequestId = 1;
            _messageSizeMax = adapter != null ? adapter.messageSizeMax() : instance.messageSizeMax();
            _batchRequestQueue = new IceInternal.BatchRequestQueue(instance, _endpoint.datagram());
            _readStream = new InputStream(instance, Util.currentProtocolEncoding);
            _readHeader = false;
            _readStreamPos = -1;
            _writeStream = new OutputStream(instance, Util.currentProtocolEncoding);
            _writeStreamPos = -1;
            _dispatchCount = 0;
            _state = StateNotInitialized;

            _compressionLevel = initData.properties.getPropertyAsIntWithDefault("Ice.Compression.Level", 1);
            if(_compressionLevel < 1)
            {
                _compressionLevel = 1;
            }
            else if(_compressionLevel > 9)
            {
                _compressionLevel = 9;
            }

            if(adapter != null)
            {
                _servantManager = adapter.getServantManager();
            }

            try
            {
                if(adapter != null)
                {
                    _threadPool = adapter.getThreadPool();
                }
                else
                {
                    _threadPool = instance.clientThreadPool();
                }
                _threadPool.initialize(this);
            }
            catch(LocalException)
            {
                throw;
            }
            catch(System.Exception ex)
            {
                throw new SyscallException(ex);
            }
        }
Example #14
0
 createWithUnderlying(IceInternal.EndpointI underlying, List <string> args, bool oaEndpoint)
 {
     return(new EndpointI(_instance, underlying));
 }
Example #15
0
 //
 // Return a server side transceiver for this endpoint, or null if a
 // transceiver can only be created by an acceptor. In case a
 // transceiver is created, this operation also returns a new
 // "effective" endpoint, which might differ from this endpoint,
 // for example, if a dynamic port number is assigned.
 //
 public override IceInternal.Transceiver transceiver(ref IceInternal.EndpointI endpoint)
 {
     endpoint = this;
     return(null);
 }
Example #16
0
 /// <summary>
 /// Creates a new proxy that is identical to this proxy, except for the endpoints.
 /// </summary>
 /// <param name="newEndpoints">The endpoints for the new proxy.</param>
 /// <returns>The proxy with the new endpoints.</returns>
 public ObjectPrx ice_endpoints(Endpoint[] newEndpoints)
 {
     if(Arrays.Equals(newEndpoints, _reference.getEndpoints()))
     {
         return this;
     }
     else
     {
         IceInternal.EndpointI[] endpts = new IceInternal.EndpointI[newEndpoints.Length];
         for(int i = 0; i < newEndpoints.Length; ++i)
         {
             endpts[i] = (IceInternal.EndpointI)newEndpoints[i];
         }
         return newInstance(_reference.changeEndpoints(endpts));
     }
 }
Example #17
0
        private ObjectPrx newDirectProxy(Identity ident, string facet)
        {
            IceInternal.EndpointI[] endpoints;

            //
            // Use the published endpoints, otherwise use the endpoints from all
            // incoming connection factories.
            //
            int sz = _publishedEndpoints.Count;
            endpoints = new IceInternal.EndpointI[sz + _routerEndpoints.Count];
            for(int i = 0; i < sz; ++i)
            {
                endpoints[i] = _publishedEndpoints[i];
            }

            //
            // Now we also add the endpoints of the router's server proxy, if
            // any. This way, object references created by this object adapter
            // will also point to the router's server proxy endpoints.
            //
            for(int i = 0; i < _routerEndpoints.Count; ++i)
            {
                endpoints[sz + i] = _routerEndpoints[i];
            }

            //
            // Create a reference and return a proxy for this reference.
            //
            IceInternal.Reference reference = instance_.referenceFactory().create(ident, facet, _reference, endpoints);
            return instance_.proxyFactory().referenceToProxy(reference);
        }
Example #18
0
 readWithUnderlying(IceInternal.EndpointI underlying, Ice.InputStream s)
 {
     return(new EndpointI(_instance, underlying));
 }
Example #19
0
        internal ConnectionI(IceInternal.Instance instance, IceInternal.ConnectionReaper reaper, 
                             IceInternal.Transceiver transceiver, IceInternal.Connector connector,
                             IceInternal.EndpointI endpoint, ObjectAdapter adapter)
        {
            _instance = instance;
            _reaper = reaper;
            InitializationData initData = instance.initializationData();
            _transceiver = transceiver;
            _desc = transceiver.ToString();
            _type = transceiver.type();
            _connector = connector;
            _endpoint = endpoint;
            _adapter = adapter;
            _dispatcher = initData.dispatcher; // Cached for better performance.
            _logger = initData.logger; // Cached for better performance.
            _traceLevels = instance.traceLevels(); // Cached for better performance.
            _timer = instance.timer();
            _writeTimeout = new TimeoutCallback(this);
            _writeTimeoutScheduled = false;
            _readTimeout = new TimeoutCallback(this);
            _readTimeoutScheduled = false;
            _warn = initData.properties.getPropertyAsInt("Ice.Warn.Connections") > 0;
            _warnUdp = initData.properties.getPropertyAsInt("Ice.Warn.Datagrams") > 0;
            _cacheBuffers = initData.properties.getPropertyAsIntWithDefault("Ice.CacheMessageBuffers", 1) == 1;
            _acmAbsoluteTimeoutMillis = 0;
            _nextRequestId = 1;
            _batchAutoFlush = initData.properties.getPropertyAsIntWithDefault("Ice.BatchAutoFlush", 1) > 0;
            _batchStream = new IceInternal.BasicStream(instance, _batchAutoFlush);
            _batchStreamInUse = false;
            _batchRequestNum = 0;
            _batchRequestCompress = false;
            _batchMarker = 0;
            _readStream = new IceInternal.BasicStream(instance);
            _readHeader = false;
            _writeStream = new IceInternal.BasicStream(instance);
            _dispatchCount = 0;
            _state = StateNotInitialized;

            _compressionLevel = initData.properties.getPropertyAsIntWithDefault("Ice.Compression.Level", 1);
            if(_compressionLevel < 1)
            {
                _compressionLevel = 1;
            }
            else if(_compressionLevel > 9)
            {
                _compressionLevel = 9;
            }

            ObjectAdapterI adapterImpl = _adapter as ObjectAdapterI;
            if(adapterImpl != null)
            {
                _servantManager = adapterImpl.getServantManager();
            }

            try
            {
                if(_endpoint.datagram())
                {
                    _acmTimeout = 0;
                }
                else
                {
                    if(adapterImpl != null)
                    {
                        _acmTimeout = adapterImpl.getACM();
                    }
                    else
                    {
                        _acmTimeout = _instance.clientACM();
                    }
                }

                if(adapterImpl != null)
                {
                    _threadPool = adapterImpl.getThreadPool();
                }
                else
                {
                    _threadPool = instance.clientThreadPool();
                }
                _threadPool.initialize(this);
            }
            catch(LocalException)
            {
                throw;
            }
            catch(System.Exception ex)
            {
                throw new SyscallException(ex);
            }
        }