Fix a segfault on startup :(

This commit is contained in:
Steve Dee 2014-03-07 16:46:22 -08:00
parent 8eec695a92
commit 7371ba09fc

View File

@ -1336,8 +1336,6 @@ _raft_foll_init(u2_raft* raf_u)
// Start the initial election timeout. // Start the initial election timeout.
{ {
uv_timer_init(u2L, &raf_u->tim_u);
raf_u->tim_u.data = raf_u;
uv_timer_start(&raf_u->tim_u, _raft_time_cb, _raft_election_rand(), 0); uv_timer_start(&raf_u->tim_u, _raft_time_cb, _raft_election_rand(), 0);
} }
} }
@ -1359,6 +1357,10 @@ u2_raft_init()
{ {
u2_raft* raf_u = u2R; u2_raft* raf_u = u2R;
// Initialize timer -- used in both single and multi-instance mode, for different things.
uv_timer_init(u2L, &raf_u->tim_u);
raf_u->tim_u.data = raf_u;
if ( 0 == u2_Host.ops_u.raf_c ) { if ( 0 == u2_Host.ops_u.raf_c ) {
_raft_lone_init(raf_u); _raft_lone_init(raf_u);
} }