示例#1
0
 public void SetLoggerHandler(MessageForLogger handler)
 {
     LogMessage += handler;
     m_protocol.SetLoggerHandler(handler);
     m_suzuki.SetLoggerHandler(handler);
     m_election.SetLoggerHandler(handler);
 }
示例#2
0
        public void             Init(MessageForLogger handler)
        {
            m_configuration = JsonConvert.DeserializeObject <Config.Configuration>(ReadConfig(ConfigPath));

            m_protocol.Init(m_configuration);

            m_suzuki.Init(m_configuration);
            m_suzuki.Send            = Send;
            m_suzuki.SendBroadcast   = SendBroadcast;
            m_suzuki.RestartElection = StartElection;

            m_election.Init(m_configuration);
            m_election.Send          = Send;
            m_election.SendBroadcast = SendBroadcast;
            m_election.WonElection   = ElectionEnded;

            m_receiver = new Thread(QueryMessage);
            m_receiver.Start();

            SetLoggerHandler(handler);

            LogMessage(this, "Suzuki started. Node info: [" + m_configuration.NodeID + "] Port:" + m_configuration.Port);
        }
示例#3
0
 public void SetLoggerHandler(MessageForLogger handler)
 {
     LogMessage += handler;
 }