public override void StartConnection() { Logger.Info("Starting Authentication Server"); ConversationManager.PrimaryCommunicator.State_OnChanged += CommunicatorState_OnChanged; ConversationManager.PrimaryCommunicator.Start(); Registration_OnChange?.Invoke(MyProcessInfo); }
public ProcessInfo ValidateProcess(ProcessInfo newProcess) { if (newProcess == null) { return(null); } Logger.Trace("Received login request from a process"); bool success = true; switch (newProcess.Type) { case ProcessInfo.ProcessType.Client: newProcess.ProcessId = NewProcessId; KnownClients[newProcess.ProcessId] = newProcess; break; case ProcessInfo.ProcessType.ContractManager: newProcess.ProcessId = 1; ContractManagerInfo = newProcess; break; default: success = false; break; } if (success) { newProcess.Status = ProcessInfo.StatusCode.Registered; newProcess.HeartbeatTimer = Scheduler.GetIntervalTimerMillis(HeartbeatIntervalMs); newProcess.HeartbeatTimer.Elapsed += (sender, e) => OnHeartbeatExpired(sender, e, newProcess); newProcess.HeartbeatTimer.Enabled = true; Registration_OnChange?.Invoke(ProcessInfo.DeepCopy(newProcess)); } else { newProcess.Status = ProcessInfo.StatusCode.Terminated; Logger.Info($"Cannot register {newProcess.LabelAndId} "); } return(ProcessInfo.DeepCopy(newProcess)); }
public void HandleLoginUpdated(ProcessInfo myProcess) { Logger.Trace("Received login response"); MyProcessInfo = myProcess; Registration_OnChange?.Invoke(myProcess); }