Message parsing and serialization, connection to other legislators

This commit is contained in:
juju committed 2020-05-05 20:43:35 +02:00
1 parent fd4de7091c
commit 6b80cc68ce
12 files changed
+337 -11

No files matched your search

+12 -3
View File
@@ -1,6 +1,10 @@
#include <string>
#include "legislator.hh"
#include "misc/logger.hh"
#include <string>
#include "message/message.hh"
#include "events/register.hh"
#include "events/send.hh"
namespace paxos
{
@@ -20,8 +24,13 @@ namespace paxos
void Legislator::send_next_ballot(int ballot)
{
ballot = ballot;
return;
std::string ballot_string = std::to_string(ballot);
Message message;
message.set_method("NextBallot");
message.add_header("ballot", ballot_string);
for (auto legislator : legislators)
SendEW::send_message(message, legislator.second);
}
void Legislator::receive_next_ballot(int ballot, std::string sender)
+1 -1
View File
@@ -27,5 +27,5 @@ namespace paxos
using shared_legislator = std::shared_ptr<Legislator>;
extern shared_legislator self;
extern std::vector<shared_legislator> legislators;
extern std::unordered_map<std::string, shared_legislator> legislators;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.