public IACMMonitor Acm(int?timeout, ACMClose?c, ACMHeartbeat?h) { Debug.Assert(_communicator != null); ACMConfig config = _config.Clone(); if (timeout.HasValue) { config.Timeout = timeout.Value * 1000; // To milliseconds } if (c.HasValue) { config.Close = c.Value; } if (h.HasValue) { config.Heartbeat = h.Value; } return(new ConnectionACMMonitor(this, _communicator.Timer(), config)); }
internal FactoryACMMonitor(Communicator communicator, ACMConfig config) { _communicator = communicator; _config = config; }
internal ConnectionACMMonitor(FactoryACMMonitor parent, Timer timer, ACMConfig config) { _parent = parent; _timer = timer; _config = config; }
public IncomingConnectionFactory(ObjectAdapter adapter, Endpoint endpoint, Endpoint?publish, ACMConfig acmConfig) { _communicator = adapter.Communicator; _endpoint = endpoint; _publishedEndpoint = publish; _adapter = adapter; _warn = _communicator.GetPropertyAsBool("Ice.Warn.Connections") ?? false; _monitor = new FactoryACMMonitor(_communicator, acmConfig); if (_communicator.OverrideTimeout != null) { _endpoint = _endpoint.NewTimeout(_communicator.OverrideTimeout.Value); } if (_communicator.OverrideCompress != null) { _endpoint = _endpoint.NewCompressionFlag(_communicator.OverrideCompress.Value); } try { _transceiver = _endpoint.GetTransceiver(); if (_transceiver != null) { if (_communicator.TraceLevels.Network >= 2) { _communicator.Logger.Trace(_communicator.TraceLevels.NetworkCat, $"attempting to bind to {_endpoint.Name} socket\n{_transceiver}"); } _endpoint = _transceiver.Bind(); var connection = new Connection(_communicator, null, _transceiver, null, _endpoint, _adapter); _ = connection.StartAsync(); _connections.Add(connection); } else { _acceptor = _endpoint.GetAcceptor(_adapter !.Name); if (_communicator.TraceLevels.Network >= 2) { _communicator.Logger.Trace(_communicator.TraceLevels.NetworkCat, $"attempting to bind to {_endpoint.Name} socket {_acceptor}"); } _endpoint = _acceptor !.Listen(); if (_communicator.TraceLevels.Network >= 1) { _communicator.Logger.Trace(_communicator.TraceLevels.NetworkCat, $"listening for {_endpoint.Name} connections\n{_acceptor!.ToDetailedString()}"); } } } catch (System.Exception) { // // Clean up. // try { _transceiver?.Close(); _acceptor?.Close(); } catch (System.Exception) { // Ignore } _monitor.Destroy(); _connections.Clear(); throw; } }