Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/raft.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,13 @@ static void update_ticket_from_msg(struct ticket_config *tk,
static void copy_ticket_from_msg(struct ticket_config *tk,
struct boothc_ticket_msg *msg)
{
tk->term_expires = time(NULL) + ntohl(msg->ticket.term_valid_for);
tk->current_term = ntohl(msg->ticket.term);
tk->commit_index = ntohl(msg->ticket.leader_commit);
if (msg) {
tk->term_expires = time(NULL) + ntohl(msg->ticket.term_valid_for);
tk->current_term = ntohl(msg->ticket.term);
tk->commit_index = ntohl(msg->ticket.leader_commit);
} else {
tk->term_expires = time(NULL) + tk->term_duration;
}
}

static void become_follower(struct ticket_config *tk,
Expand Down