feat(election-iomgr-refactor): add vote_ep_ctx_t and on_vote_connected

- vote_ep_ctx_t: per-peer context (ha, c, ctx, peer_idx, term/tag/lsn/name)
- election_timeout_ctx_t: cancelled flag + context for delay watchdog
- on_vote_connected(): iomgr callback fires after SSL handshake; builds
  xce_request_t{opcode=OPCode_requestVote}, calls xce_request, sets msg_handler
- vote_reply_msg_handler stub (returns 0; implemented in task 2.3)
- Test seam: xce_vote_request_hook for unit testing without live SSL
- 4 new unit tests: opcode, field encoding, msg_handler set, cancelled flag

Context note: vctx->c is NULL in test helper — task 2.3 must use real cluster_t*
This commit is contained in:
Rongsong Shen 2026-05-30 08:09:33 +00:00
parent 0d7757fdd5
commit 18c280429e
4 changed files with 500 additions and 0 deletions

View file

@ -43,6 +43,7 @@ extern void test_persist_truncate(void);
extern void test_ha_connect(void);
extern void test_ha_ctrlhello(void);
extern void test_ha_failover(void);
extern void test_ha_vote_send(void);
void setUp(void) { return; }
@ -155,6 +156,7 @@ int main(int argc, char* argv[])
TEST(test_ha_connect);
TEST(test_ha_ctrlhello);
TEST(test_ha_failover);
TEST(test_ha_vote_send);
return UNITY_END();
}