File tree 2 files changed +4
-2
lines changed
2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ struct timeval ms2tv(int ms);
48
48
49
49
#define shout (...) \
50
50
do { \
51
+ fprintf(stderr, "RAFT: "); \
51
52
fprintf(stderr, __VA_ARGS__); \
52
53
fflush(stderr); \
53
54
} while (0)
Original file line number Diff line number Diff line change @@ -649,7 +649,7 @@ void raft_tick(raft_t r, int msec) {
649
649
if (r -> timer < 0 ) {
650
650
switch (r -> role ) {
651
651
case FOLLOWER :
652
- debug (
652
+ shout (
653
653
"lost the leader,"
654
654
" claiming leadership\n"
655
655
);
@@ -659,7 +659,7 @@ void raft_tick(raft_t r, int msec) {
659
659
raft_claim (r );
660
660
break ;
661
661
case CANDIDATE :
662
- debug (
662
+ shout (
663
663
"the vote failed,"
664
664
" claiming leadership\n"
665
665
);
@@ -1055,6 +1055,7 @@ static void raft_handle_claim(raft_t r, raft_msg_claim_t *m) {
1055
1055
reply .granted = true;
1056
1056
}
1057
1057
finish :
1058
+ shout ("voting %s\n" , reply .granted ? "yes" : "no" );
1058
1059
raft_send (r , candidate , & reply , sizeof (reply ));
1059
1060
}
1060
1061
You can’t perform that action at this time.
0 commit comments