示例#1
0
 public override void StartConnection()
 {
     Logger.Info("Starting Authentication Server");
     ConversationManager.PrimaryCommunicator.State_OnChanged += CommunicatorState_OnChanged;
     ConversationManager.PrimaryCommunicator.Start();
     Registration_OnChange?.Invoke(MyProcessInfo);
 }
示例#2
0
        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));
        }
示例#3
0
 public void HandleLoginUpdated(ProcessInfo myProcess)
 {
     Logger.Trace("Received login response");
     MyProcessInfo = myProcess;
     Registration_OnChange?.Invoke(myProcess);
 }