/// <summary> /// Constructor for passing in parameters. /// </summary> public TClientStillAliveCheck(TConnectedClient AConnectedClient, TClientServerConnectionType AClientServerConnectionType, TDelegateTearDownAppDomain ATearDownAppDomain, string AUser = "") { FClientObject = AConnectedClient; ClientName = FClientObject.ClientName; // Note: calls to TLogging here only go to the console. The log file doesn't get initialised in TLogging until TClientDomainManager.EstablishDBConnection() TLogging.LogAtLevel(10, "TClientStillAliveCheck (for ClientName '" + ClientName + "'') created"); Int32 ClientStillAliveTimeout = TAppSettingsManager.GetInt32("Server.ClientKeepAliveTimeoutAfterXSeconds_LAN", 60); UClientStillAliveTimeout = ClientStillAliveTimeout; UClientStillAliveCheckInterval = TAppSettingsManager.GetInt32("Server.ClientKeepAliveCheckIntervalInSeconds", 60); UTearDownAppDomain = ATearDownAppDomain; // UTearDownAppDomainToken = ATearDownAppDomainToken; TLogging.LogAtLevel(2, "ClientStillAliveTimeout: " + ClientStillAliveTimeout.ToString() + "; " + "ClientKeepAliveCheckIntervalInSeconds: " + UClientStillAliveCheckInterval.ToString()); // Start ClientStillAliveCheckThread UKeepServerAliveCheck = true; UClientStillAliveCheckThread = new Thread(new ThreadStart(ClientStillAliveCheckThread)); UClientStillAliveCheckThread.Name = "ClientStillAliveCheckThread" + Guid.NewGuid().ToString(); UClientStillAliveCheckThread.IsBackground = true; UClientStillAliveCheckThread.Start(); TLogging.LogAtLevel(10, "TClientStillAliveCheck (for ClientName '" + ClientName + "'): started " + UClientStillAliveCheckThread.Name); }
/// start the session public void StartSession(TDelegateTearDownAppDomain ATearDownAppDomain) { FTasksManager = new TClientTasksManager(); FPollClientTasks = new TPollClientTasks(FTasksManager); FClientConnectionStartTime = DateTime.Now; // Start ClientStillAliveCheck Thread new ClientStillAliveCheck.TClientStillAliveCheck(this, FClientServerConnectionType, ATearDownAppDomain); SessionStatus = TSessionStatus.adsActive; FClientConnectionFinishedTime = DateTime.Now; }
/// <summary> /// Constructor for passing in parameters. /// </summary> public TClientStillAliveCheck(TConnectedClient AConnectedClient, TClientServerConnectionType AClientServerConnectionType, TDelegateTearDownAppDomain ATearDownAppDomain, string AUser = "") { FClientObject = AConnectedClient; ClientName = FClientObject.ClientName; Int32 ClientStillAliveTimeout; // Note: calls to TLogging here only go to the console. The log file doesn't get initialised in TLogging until TClientDomainManager.EstablishDBConnection() TLogging.LogAtLevel(10, "TClientStillAliveCheck (for ClientName '" + ClientName + "'') created"); // Determine timeout limit (different for Clients connected via LAN or Remote) if (AClientServerConnectionType == TClientServerConnectionType.csctRemote) { ClientStillAliveTimeout = TSrvSetting.ClientKeepAliveTimeoutAfterXSecondsRemote; } else if (AClientServerConnectionType == TClientServerConnectionType.csctLAN) { ClientStillAliveTimeout = TSrvSetting.ClientKeepAliveTimeoutAfterXSecondsLAN; } else { ClientStillAliveTimeout = TSrvSetting.ClientKeepAliveTimeoutAfterXSecondsLAN; } UClientStillAliveTimeout = ClientStillAliveTimeout; UClientStillAliveCheckInterval = TSrvSetting.ClientKeepAliveCheckIntervalInSeconds; UTearDownAppDomain = ATearDownAppDomain; // UTearDownAppDomainToken = ATearDownAppDomainToken; TLogging.LogAtLevel(2, "ClientStillAliveTimeout: " + ClientStillAliveTimeout.ToString() + "; " + "ClientKeepAliveCheckIntervalInSeconds: " + UClientStillAliveCheckInterval.ToString()); // Start ClientStillAliveCheckThread UKeepServerAliveCheck = true; UClientStillAliveCheckThread = new Thread(new ThreadStart(ClientStillAliveCheckThread)); UClientStillAliveCheckThread.Name = "ClientStillAliveCheckThread" + Guid.NewGuid().ToString(); UClientStillAliveCheckThread.IsBackground = true; UClientStillAliveCheckThread.Start(); TLogging.LogAtLevel(10, "TClientStillAliveCheck (for ClientName '" + ClientName + "'): started " + UClientStillAliveCheckThread.Name); }
/// <summary> /// Constructor for passing in parameters. /// </summary> public TClientStillAliveCheck(TConnectedClient AConnectedClient, TClientServerConnectionType AClientServerConnectionType, TDelegateTearDownAppDomain ATearDownAppDomain) { FClientObject = AConnectedClient; ClientName = FClientObject.ClientName; Int32 ClientStillAliveTimeout; TLogging.LogAtLevel(2, "TClientStillAliveCheck (for ClientName '" + ClientName + "'') created"); // Determine timeout limit (different for Clients connected via LAN or Remote) if (AClientServerConnectionType == TClientServerConnectionType.csctRemote) { ClientStillAliveTimeout = TSrvSetting.ClientKeepAliveTimeoutAfterXSecondsRemote; } else if (AClientServerConnectionType == TClientServerConnectionType.csctLAN) { ClientStillAliveTimeout = TSrvSetting.ClientKeepAliveTimeoutAfterXSecondsLAN; } else { ClientStillAliveTimeout = TSrvSetting.ClientKeepAliveTimeoutAfterXSecondsLAN; } UClientStillAliveTimeout = ClientStillAliveTimeout; UClientStillAliveCheckInterval = TSrvSetting.ClientKeepAliveCheckIntervalInSeconds; UTearDownAppDomain = ATearDownAppDomain; // UTearDownAppDomainToken = ATearDownAppDomainToken; TLogging.LogAtLevel(2, "ClientStillAliveTimeout: " + ClientStillAliveTimeout.ToString() + "; " + "ClientKeepAliveCheckIntervalInSeconds: " + UClientStillAliveCheckInterval.ToString()); // Start ClientStillAliveCheckThread UKeepServerAliveCheck = true; UClientStillAliveCheckThread = new Thread(new ThreadStart(ClientStillAliveCheckThread)); UClientStillAliveCheckThread.Name = "ClientStillAliveCheckThread" + Guid.NewGuid().ToString(); UClientStillAliveCheckThread.IsBackground = true; UClientStillAliveCheckThread.Start(); TLogging.LogAtLevel(2, "TClientStillAliveCheck (for ClientName '" + ClientName + "'): started ClientStillAliveCheckThread."); }
/** * Constructor for passing in parameters. * * @param AClientServerConnectionType Type of Client connection * @param ATearDownAppDomain Delegate that is called once * ClientStillAliveCheckThread finds out that the Client is no longer 'alive' * @param ATearDownAppDomainToken Security Token. Prevents against unauthorized * tearing down of the Client's AppDomain. * */ public TClientStillAliveCheck(TClientServerConnectionType AClientServerConnectionType, TDelegateTearDownAppDomain ATearDownAppDomain, String ATearDownAppDomainToken) { Int32 ClientStillAliveTimeout; if (TLogging.DL >= 10) { Console.WriteLine("{0} TClientStillAliveCheck created", DateTime.Now); } // Determine timeout limit (different for Clients connected via LAN or Remote) if (AClientServerConnectionType == TClientServerConnectionType.csctRemote) { ClientStillAliveTimeout = TSrvSetting.ClientKeepAliveTimeoutAfterXSecondsRemote; } else if (AClientServerConnectionType == TClientServerConnectionType.csctLAN) { ClientStillAliveTimeout = TSrvSetting.ClientKeepAliveTimeoutAfterXSecondsLAN; } else { ClientStillAliveTimeout = TSrvSetting.ClientKeepAliveTimeoutAfterXSecondsLAN; } UClientStillAliveTimeout = ClientStillAliveTimeout; UClientStillAliveCheckInterval = TSrvSetting.ClientKeepAliveCheckIntervalInSeconds; UTearDownAppDomain = ATearDownAppDomain; UTearDownAppDomainToken = ATearDownAppDomainToken; // Start ClientStillAliveCheckThread UKeepServerAliveCheck = true; UClientStillAliveCheckThread = new Thread(new ThreadStart(ClientStillAliveCheckThread)); UClientStillAliveCheckThread.IsBackground = true; UClientStillAliveCheckThread.Start(); if (TLogging.DL >= 10) { Console.WriteLine("{0} TClientStillAliveCheck: started ClientStillAliveCheckThread.", DateTime.Now); } }