예제 #1
0
        public void View_Change(object sender, ElapsedEventArgs e, string timeout)
        {
            System.Console.WriteLine(timeout);
            string View_Message = "view change message";

            //create and send a view change message to all other nodes
            state.mode = Mode.View_Change;
            view_change msg = new view_change {
                id            = configs.PublicKey,
                message       = View_Message,
                seq           = state.Seq,
                view_number   = state.view_number,
                message_Type  = Message_Type.view_change,
                Primary_Index = state.Primary_Index,
            };
            Temp_view_Message Message = new Temp_view_Message {
                id           = configs.PublicKey,
                message      = View_Message,
                seq          = state.Seq,
                view_number  = state.view_number,
                message_Type = Message_Type.view_change,
            };

            Message.New_Primary_Event += New_Primary;
            Add_To_Temp_View(Message);
            Send_Message(Sign_Message(msg));
        }
예제 #2
0
 public void Add_To_Temp_View(pbft_message Message)
 {
     if (!Temporary_View_Change_messages.ContainsKey(Message.view_number))
     {
         Temp_view_Message temp = new Temp_view_Message()
         {
             message     = Message.message,
             id          = Message.id,
             seq         = Message.seq,
             view_number = Message.view_number,
         };
         temp.New_Primary_Event += New_Primary;
         Temporary_View_Change_messages.Add(Message.view_number, temp);
     }
     //verify if this has trigered a new primary call already or not
     Temporary_View_Change_messages[Message.view_number].View_Counter++;
 }