internal Lookup( LocatorRegistry registry, ILookupPrx lookup, Communicator communicator, ObjectAdapter replyAdapter) { _replyAdapter = replyAdapter; _registry = registry; _lookup = lookup; _timeout = communicator.GetPropertyAsTimeSpan("IceDiscovery.Timeout") ?? TimeSpan.FromMilliseconds(300); if (_timeout == Timeout.InfiniteTimeSpan) { _timeout = TimeSpan.FromMilliseconds(300); } _retryCount = communicator.GetPropertyAsInt("IceDiscovery.RetryCount") ?? 3; _latencyMultiplier = communicator.GetPropertyAsInt("IceDiscovery.LatencyMultiplier") ?? 1; if (_latencyMultiplier < 1) { throw new InvalidConfigurationException( "The value of `IceDiscovery.LatencyMultiplier' must be a positive integer greater than 0"); } _domainId = communicator.GetProperty("IceDiscovery.DomainId") ?? ""; // Create one lookup proxy per endpoint from the given proxy. We want to send a multicast // datagram on each endpoint. ILookupReplyPrx lookupReply = _replyAdapter.CreateProxy( "dummy", ILookupReplyPrx.Factory).Clone(invocationMode: InvocationMode.Datagram); var single = new Endpoint[1]; foreach (Endpoint endpoint in lookup.Endpoints) { // lookup's invocation mode is Datagram Debug.Assert(endpoint.Transport == Transport.UDP); single[0] = endpoint; ILookupPrx?key = lookup.Clone(endpoints: single); if (endpoint["interface"] is string mcastInterface && mcastInterface.Length > 0) { Endpoint?q = lookupReply.Endpoints.FirstOrDefault(e => e.Host == mcastInterface); if (q != null) { single[0] = q; _lookups[key] = lookupReply.Clone(endpoints: single); } } if (!_lookups.ContainsKey(key)) { // Fallback: just use the given lookup reply proxy if no matching endpoint found. _lookups[key] = lookupReply; } } Debug.Assert(_lookups.Count > 0); }
internal Locator( string name, ILookupPrx lookup, Communicator communicator, string instanceName, ILocatorPrx voidLocator, ILookupReplyPrx lookupReply) { _lookup = lookup; _timeout = communicator.GetPropertyAsTimeSpan($"{name}.Timeout") ?? TimeSpan.FromMilliseconds(300); if (_timeout == System.Threading.Timeout.InfiniteTimeSpan) { _timeout = TimeSpan.FromMilliseconds(300); } _retryCount = Math.Max(communicator.GetPropertyAsInt($"{name}.RetryCount") ?? 3, 1); _retryDelay = communicator.GetPropertyAsTimeSpan($"{name}.RetryDelay") ?? TimeSpan.FromMilliseconds(2000); _traceLevel = communicator.GetPropertyAsInt($"{name}.Trace.Lookup") ?? 0; _instanceName = instanceName; _warned = false; _locator = lookup.Communicator.DefaultLocator; _voidLocator = voidLocator; // Create one lookup proxy per endpoint from the given proxy. We want to send a multicast // datagram on each endpoint. var single = new Endpoint[1]; foreach (Endpoint endpoint in lookup.Endpoints) { // lookup's invocation mode is Datagram Debug.Assert(endpoint.Transport == Transport.UDP); single[0] = endpoint; ILookupPrx key = lookup.Clone(endpoints: single); if (endpoint["interface"] is string mcastInterface && mcastInterface.Length > 0) { Endpoint?q = lookupReply.Endpoints.FirstOrDefault(e => e.Host == mcastInterface); if (q != null) { single[0] = q; _lookups[key] = lookupReply.Clone(endpoints: single); } } if (!_lookups.ContainsKey(key)) { // Fallback: just use the given lookup reply proxy if no matching endpoint found. _lookups[key] = lookupReply; } } Debug.Assert(_lookups.Count > 0); }
internal Locator( string name, ILookupPrx lookup, Communicator communicator, string instanceName, ILocatorPrx voidLocator, ILookupReplyPrx lookupReply) { _lookup = lookup; _timeout = communicator.GetPropertyAsInt($"{name}.Timeout") ?? 300; if (_timeout < 0) { _timeout = 300; } _retryCount = Math.Max(communicator.GetPropertyAsInt($"{name}.RetryCount") ?? 3, 1); _retryDelay = Math.Max(communicator.GetPropertyAsInt($"{name}.RetryDelay") ?? 2000, 0); _traceLevel = communicator.GetPropertyAsInt($"{name}.Trace.Lookup") ?? 0; _instanceName = instanceName; _warned = false; _locator = lookup.Communicator.DefaultLocator; _voidLocator = voidLocator; // Create one lookup proxy per endpoint from the given proxy. We want to send a multicast // datagram on each endpoint. var single = new Endpoint[1]; foreach (UdpEndpoint endpoint in lookup.Endpoints.Cast <UdpEndpoint>()) { single[0] = endpoint; ILookupPrx key = lookup.Clone(endpoints: single); if (endpoint.McastInterface.Length > 0) { IPEndpoint?q = lookupReply.Endpoints.Cast <IPEndpoint>().FirstOrDefault( e => e is IPEndpoint ipEndpoint && ipEndpoint.Host.Equals(endpoint.McastInterface)); if (q != null) { single[0] = q; _lookups[key] = lookupReply.Clone(endpoints: single); } } if (!_lookups.ContainsKey(key)) { // Fallback: just use the given lookup reply proxy if no matching endpoint found. _lookups[key] = lookupReply; } } Debug.Assert(_lookups.Count > 0); }
internal Lookup(LocatorRegistry registry, ILookupPrx lookup, Communicator communicator, ObjectAdapter replyAdapter) { _replyAdapter = replyAdapter; _registry = registry; _lookup = lookup; _timeout = communicator.GetPropertyAsTimeSpan("IceDiscovery.Timeout") ?? TimeSpan.FromMilliseconds(300); if (_timeout == System.Threading.Timeout.InfiniteTimeSpan) { _timeout = TimeSpan.FromMilliseconds(300); } _retryCount = communicator.GetPropertyAsInt("IceDiscovery.RetryCount") ?? 3; _latencyMultiplier = communicator.GetPropertyAsInt("IceDiscovery.LatencyMultiplier") ?? 1; _domainId = communicator.GetProperty("IceDiscovery.DomainId") ?? ""; // Create one lookup proxy per endpoint from the given proxy. We want to send a multicast // datagram on each endpoint. ILookupReplyPrx lookupReply = _replyAdapter.CreateProxy( "dummy", ILookupReplyPrx.Factory).Clone(invocationMode: InvocationMode.Datagram); var single = new Endpoint[1]; foreach (UdpEndpoint endpoint in lookup.Endpoints.Cast <UdpEndpoint>()) { single[0] = endpoint; ILookupPrx?key = lookup.Clone(endpoints: single); if (endpoint.McastInterface.Length > 0) { Endpoint?q = lookupReply.Endpoints.FirstOrDefault( e => e is IPEndpoint ipEndpoint && ipEndpoint.Host.Equals(endpoint.McastInterface)); if (q != null) { single[0] = q; _lookups[key] = lookupReply.Clone(endpoints: single); } } if (!_lookups.ContainsKey(key)) { // Fallback: just use the given lookup reply proxy if no matching endpoint found. _lookups[key] = lookupReply; } } Debug.Assert(_lookups.Count > 0); }
public LocatorI(string name, ILookupPrx lookup, Communicator communicator, string instanceName, ILocatorPrx voidLocator) { _lookup = lookup; _timeout = communicator.GetPropertyAsInt($"{name}.Timeout") ?? 300; if (_timeout < 0) { _timeout = 300; } _retryCount = communicator.GetPropertyAsInt("${name}.RetryCount") ?? 3; if (_retryCount < 0) { _retryCount = 0; } _retryDelay = communicator.GetPropertyAsInt($"{name}.RetryDelay") ?? 2000; if (_retryDelay < 0) { _retryDelay = 0; } _timer = lookup.Communicator.Timer(); _traceLevel = communicator.GetPropertyAsInt($"{name}.Trace.Lookup") ?? 0; _instanceName = instanceName; _warned = false; _locator = lookup.Communicator.GetDefaultLocator(); _voidLocator = voidLocator; _pending = false; _pendingRetryCount = 0; _failureCount = 0; _warnOnce = true; // // Create one lookup proxy per endpoint from the given proxy. We want to send a multicast // datagram on each endpoint. // var single = new IEndpoint[1]; foreach (IEndpoint endpt in lookup.Endpoints) { single[0] = endpt; _lookups[lookup.Clone(endpoints: single)] = null; } Debug.Assert(_lookups.Count > 0); }
public Lookup(LocatorRegistry registry, ILookupPrx lookup, Communicator communicator) { _registry = registry; _lookup = lookup; _timeout = communicator.GetPropertyAsInt("IceDiscovery.Timeout") ?? 300; _retryCount = communicator.GetPropertyAsInt("IceDiscovery.RetryCount") ?? 3; _latencyMultiplier = communicator.GetPropertyAsInt("IceDiscovery.LatencyMultiplier") ?? 1; _domainId = communicator.GetProperty("IceDiscovery.DomainId") ?? ""; _timer = lookup.Communicator.Timer(); // // Create one lookup proxy per endpoint from the given proxy. We want to send a multicast // datagram on each endpoint. // var single = new Ice.IEndpoint[1]; foreach (IEndpoint endpt in lookup.Endpoints) { single[0] = endpt; _lookups[lookup.Clone(endpoints: single)] = null; } Debug.Assert(_lookups.Count > 0); }