Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Willemt Raft
Commits
95a5781f
Commit
95a5781f
authored
Jun 11, 2016
by
Willem Thiart
Browse files
raft_periodic can now return RAFT_ERR_SHUTDOWN
parent
9c758317
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/raft.h
View file @
95a5781f
...
...
@@ -384,7 +384,10 @@ void raft_set_request_timeout(raft_server_t* me, int msec);
/** Process events that are dependent on time passing.
* @param[in] msec_elapsed Time in milliseconds since the last call
* @return 0 on success */
* @return
* 0 on success;
* -1 on failure;
* RAFT_ERR_SHUTDOWN when server should be shutdown */
int
raft_periodic
(
raft_server_t
*
me
,
int
msec_elapsed
);
/** Receive an appendentries message.
...
...
src/raft_server.c
View file @
95a5781f
...
...
@@ -191,8 +191,7 @@ int raft_periodic(raft_server_t* me_, int msec_since_last_period)
}
if
(
me
->
last_applied_idx
<
me
->
commit_idx
)
if
(
-
1
==
raft_apply_entry
(
me_
))
return
-
1
;
return
raft_apply_entry
(
me_
);
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment