Add send_voted

This commit is contained in:
Julien CLEMENT 2020-05-05 23:57:16 +02:00
parent 8b1aaa5d36
commit 3cb93361f2
2 changed files with 12 additions and 1 deletions

@ -182,7 +182,16 @@ namespace paxos
vote.decree = decree; vote.decree = decree;
ledger.set_prev_vote(vote); ledger.set_prev_vote(vote);
sender = sender; send_voted(ballot, sender);
}
void Legislator::send_voted(int ballot, std::string receiver)
{
Message message;
message.set_method("Voted");
message.add_header("ballot", std::to_string(ballot));
message.add_header("sender", self->config_.name);
SendEW::send_message(message, legislators[receiver]);
} }
void Legislator::handle_message(Message message) void Legislator::handle_message(Message message)

@ -29,6 +29,8 @@ namespace paxos
void receive_begin_ballot(Message message); void receive_begin_ballot(Message message);
void receive_begin_ballot(int ballot, int decree, std::string sender); void receive_begin_ballot(int ballot, int decree, std::string sender);
void send_voted(int ballot, std::string receiver);
void handle_message(Message message); void handle_message(Message message);
Ledger ledger; Ledger ledger;