Calling receive_next_ballot after message treatment
This commit is contained in:
parent
6795dd7127
commit
8f66b98ce3
22
config-files/three-legislators/three-legislators1.json
Normal file
22
config-files/three-legislators/three-legislators1.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"legislators" : [
|
||||
{
|
||||
"ip" : "127.0.0.1",
|
||||
"port" : 8000,
|
||||
"name" : "legislator1",
|
||||
"self" : true
|
||||
},
|
||||
{
|
||||
"ip" : "127.0.0.1",
|
||||
"port" : 8001,
|
||||
"name" : "legislator2",
|
||||
"self" : false
|
||||
},
|
||||
{
|
||||
"ip" : "127.0.0.1",
|
||||
"port" : 8002,
|
||||
"name" : "legislator3",
|
||||
"self" : false
|
||||
}
|
||||
]
|
||||
}
|
22
config-files/three-legislators/three-legislators2.json
Normal file
22
config-files/three-legislators/three-legislators2.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"legislators" : [
|
||||
{
|
||||
"ip" : "127.0.0.1",
|
||||
"port" : 8000,
|
||||
"name" : "legislator1",
|
||||
"self" : false
|
||||
},
|
||||
{
|
||||
"ip" : "127.0.0.1",
|
||||
"port" : 8001,
|
||||
"name" : "legislator2",
|
||||
"self" : true
|
||||
},
|
||||
{
|
||||
"ip" : "127.0.0.1",
|
||||
"port" : 8002,
|
||||
"name" : "legislator3",
|
||||
"self" : false
|
||||
}
|
||||
]
|
||||
}
|
22
config-files/three-legislators/three-legislators3.json
Normal file
22
config-files/three-legislators/three-legislators3.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"legislators" : [
|
||||
{
|
||||
"ip" : "127.0.0.1",
|
||||
"port" : 8000,
|
||||
"name" : "legislator1",
|
||||
"self" : false
|
||||
},
|
||||
{
|
||||
"ip" : "127.0.0.1",
|
||||
"port" : 8001,
|
||||
"name" : "legislator2",
|
||||
"self" : false
|
||||
},
|
||||
{
|
||||
"ip" : "127.0.0.1",
|
||||
"port" : 8002,
|
||||
"name" : "legislator3",
|
||||
"self" : true
|
||||
}
|
||||
]
|
||||
}
|
@ -1 +0,0 @@
|
||||
4
|
@ -1 +0,0 @@
|
||||
3
|
@ -28,6 +28,7 @@ namespace paxos
|
||||
Message message;
|
||||
message.set_method("NextBallot");
|
||||
message.add_header("ballot", ballot_string);
|
||||
message.add_header("sender", self->config_.name);
|
||||
|
||||
for (auto legislator : legislators)
|
||||
SendEW::send_message(message, legislator.second);
|
||||
@ -35,8 +36,9 @@ namespace paxos
|
||||
|
||||
void Legislator::receive_next_ballot(Message message)
|
||||
{
|
||||
message = message;
|
||||
log("received NextBallot", green);
|
||||
std::string ballot_str = *message.get_header("ballot");
|
||||
int ballot = std::stoi(ballot_str);
|
||||
receive_next_ballot(ballot, *message.get_header("sender"));
|
||||
}
|
||||
|
||||
void Legislator::receive_next_ballot(int ballot, std::string sender)
|
||||
|
Loading…
Reference in New Issue
Block a user