Better logging
This commit is contained in:
parent
6de03b2a7b
commit
2c6ccd7e40
@ -1 +0,0 @@
|
||||
0
|
@ -1 +0,0 @@
|
||||
2
|
@ -1 +0,0 @@
|
||||
0
|
@ -1 +0,0 @@
|
||||
0
|
@ -1 +0,0 @@
|
||||
0
|
@ -1 +0,0 @@
|
||||
2
|
@ -1 +0,0 @@
|
||||
0
|
@ -1 +0,0 @@
|
||||
2
|
@ -1 +0,0 @@
|
||||
0
|
@ -1 +0,0 @@
|
||||
2
|
@ -1 +0,0 @@
|
||||
0
|
@ -1 +0,0 @@
|
||||
2
|
@ -27,8 +27,6 @@ namespace paxos
|
||||
|
||||
client_socket->fcntl_set_O_NONBLOCK();
|
||||
|
||||
std::cout << "Listener: accepting client ... on " << getpid() << "\n";
|
||||
|
||||
/* Register client_socket */
|
||||
auto e = event_register.register_event<RecvEW>(client_socket);
|
||||
}
|
||||
|
@ -34,10 +34,6 @@ namespace paxos
|
||||
auto origin_ip = connection_->get_origin_ip();
|
||||
auto origin_port = connection_->get_origin_port();
|
||||
|
||||
std::cerr << "Ready to recv data on " << origin_ip << ":"
|
||||
<< origin_port << " fd: " << sock->fd_get()->fd_ << "\n";
|
||||
std::cout << "RECV on pid " << getpid() << "\n";
|
||||
|
||||
auto buf_in = connection_->get_buffer_in();
|
||||
/* Add try catch to handle session */
|
||||
try
|
||||
|
@ -26,7 +26,6 @@ namespace paxos
|
||||
auto buffer = connection_->get_buffer_out();
|
||||
std::string response = buffer.to_string();
|
||||
|
||||
log("Sending a message: ", blue);
|
||||
log(response, white);
|
||||
ssize_t write = 0;
|
||||
try
|
||||
@ -81,6 +80,7 @@ namespace paxos
|
||||
{
|
||||
std::string ip = legislator->config_.ip;
|
||||
std::string port = legislator->config_.port;
|
||||
std::string name = legislator->config_.name;
|
||||
shared_socket socket;
|
||||
try
|
||||
{
|
||||
@ -88,7 +88,7 @@ namespace paxos
|
||||
}
|
||||
catch (const ConnectionFailed& e)
|
||||
{
|
||||
log("Could not connect to " + legislator->config_.name, red);
|
||||
log("Could not connect to " + name, red);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -96,5 +96,6 @@ namespace paxos
|
||||
message.fill_buffer(connection->get_buffer_out());
|
||||
|
||||
event_register.register_event<SendEW>(connection);
|
||||
log("Sending a message to " + name + ": ", blue);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace paxos
|
||||
quorum_previous_votes.clear();
|
||||
int new_ballot_number = ledger.last_tried() + 1;
|
||||
ledger.set_last_tried(new_ballot_number);
|
||||
log(config_.name + " is initiating ballot " + std::to_string(new_ballot_number), cyan);
|
||||
log(config_.name + " is initiating ballot " + std::to_string(new_ballot_number), green);
|
||||
send_next_ballot(new_ballot_number);
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ namespace paxos
|
||||
{
|
||||
log(config_.name + " has received a NextBallot("
|
||||
+ std::to_string(ballot)
|
||||
+ ") from " + sender, cyan);
|
||||
+ ") from " + sender, green);
|
||||
int next_ballot = ledger.next_bal();
|
||||
if (ballot <= next_ballot)
|
||||
{
|
||||
@ -86,7 +86,7 @@ namespace paxos
|
||||
std::string sender = *message.get_header("sender");
|
||||
log(config_.name + " has received a LastVote("
|
||||
+ ballot_str + ", " + vote_ballot_id_str
|
||||
+ ") from " + sender, cyan);
|
||||
+ ") from " + sender, green);
|
||||
int ballot = std::stoi(ballot_str);
|
||||
int vote_ballot_id = std::stoi(vote_ballot_id_str);
|
||||
int vote_decree = std::stoi(*message.get_header("decree"));
|
||||
@ -205,7 +205,7 @@ namespace paxos
|
||||
|
||||
log(config_.name + " has received Voted("
|
||||
+ ballot_str
|
||||
+ ") from " + sender, cyan);
|
||||
+ ") from " + sender, green);
|
||||
|
||||
receive_voted(std::stoi(ballot_str), decree, sender);
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ namespace misc
|
||||
if (*this)
|
||||
{
|
||||
sys::close(fd_);
|
||||
std::cerr << "Closed " << fd_ << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user