/// <summary> /// Begins the reconnect process using a reverse connection. /// </summary> public void BeginReconnect(Session session, ReverseConnectManager reverseConnectManager, int reconnectPeriod, EventHandler callback) { lock (m_lock) { if (m_reconnectTimer != null) { throw new ServiceResultException(StatusCodes.BadInvalidState); } m_session = session; m_reconnectFailed = false; m_reconnectPeriod = reconnectPeriod; m_callback = callback; m_reverseConnectManager = reverseConnectManager; m_reconnectTimer = new System.Threading.Timer(OnReconnect, null, reconnectPeriod, Timeout.Infinite); } }
/// <summary> /// Creates the node managers for the server. /// </summary> /// <remarks> /// This method allows the sub-class create any additional node managers which it uses. The SDK /// always creates a CoreNodeManager which handles the built-in nodes defined by the specification. /// Any additional NodeManagers are expected to handle application specific nodes. /// </remarks> protected override MasterNodeManager CreateMasterNodeManager(IServerInternal server, ApplicationConfiguration configuration) { Utils.Trace("Creating the Node Managers."); List <INodeManager> nodeManagers = new List <INodeManager>(); bool ownsTypeModel = true; ConfiguredEndpointCollection endpoints = configuration.ParseExtension <ConfiguredEndpointCollection>(); // start the reverse connect host ReverseConnectManager reverseConnectManager = null; if (configuration.ClientConfiguration?.ReverseConnect != null) { var reverseConnect = configuration.ClientConfiguration.ReverseConnect; // start the reverse connection manager reverseConnectManager = new Opc.Ua.Client.ReverseConnectManager(); foreach (var endpoint in reverseConnect.ClientEndpoints) { reverseConnectManager.AddEndpoint(new Uri(endpoint.EndpointUrl)); } // start the server even if no endpoint is configured, because // app config can change during operation and the manager object // is needed reverseConnectManager.StartService(configuration); } foreach (ConfiguredEndpoint endpoint in endpoints.Endpoints) { nodeManagers.Add(new AggregationNodeManager(server, configuration, endpoint, reverseConnectManager, ownsTypeModel)); ownsTypeModel = false; } // create master node manager. return(new MasterNodeManager(server, configuration, null, nodeManagers.ToArray())); }