feat(raft-library): task 6.2 — real raft callbacks in ha.c; fix double-free + dead stubs

This commit is contained in:
Rongsong Shen 2026-05-31 07:53:00 +00:00
parent b77525deb0
commit 8f0d2d55c3
3 changed files with 552 additions and 82 deletions

View file

@ -176,6 +176,9 @@ typedef struct {
int n_peers; /* total candidate count (excluding self) */
/* ── New fields added by raft-library spec (Task 6.1) ──────── */
raft_state_t raft; /* Raft consensus state (wired in task 6.2) */
/* ── New fields added by raft-library spec (Task 6.2) ──────── */
cluster_t *raft_c; /* cluster_t* set by ha_start_election_async; used by raft callbacks */
void *raft_election_timeout_ctx; /* election_timeout_ctx_t* for cancel (task 6.2) */
} ha_state_t;
/* ── Public API ────────────────────────────────────────────── */